taco
taco

Reputation: 839

Padding in NSTextView -- possible without custom drawing?

In Cocoa, NSTextView has a rather shallow margin between text and border. Is there a way to specify a padding (distance between text and border of view) for a NSTextView without resorting to owner drawing?

Upvotes: 17

Views: 4622

Answers (1)

Boaz Stuller
Boaz Stuller

Reputation: 2544

The NSTextView method setTextContainerInset: does what you're looking for. The height and width components of the NSSize parameter specify the vertical and horizontal padding amount respectively.

For example

textView.textContainerInset = NSSize(width: 8, height: 8)

Upvotes: 33

Related Questions