Giving an NSTextView some padding/a margin
You could try subclassing NSTextView and override the textContainerOrigin
.
Details here.
For example this subclass will give a top and bottom margin of 5 left of 20 and right of 10.
@implementation MyTextView
- (void)awakeFromNib {
[super setTextContainerInset:NSMakeSize(15.0f, 5.0f)];
}
- (NSPoint)textContainerOrigin {
NSPoint origin = [super textContainerOrigin];
NSPoint newOrigin = NSMakePoint(origin.x + 5.0f, origin.y);
return newOrigin;
}
@end
Just to add an update to this. iOS7 adds a property to UITextView called textContainerInset. Calling setTextContainerInset will create margins inside the TextView for the content.