テキストビューの周りに NSBezierPathWithRoundedRect を描画するために、NSTextView をサブクラス化し、drawRect メソッドをオーバーライドしていますが、エッジが丸くなっているため、テキストビューのテキストに干渉します。
NSTextView のテキスト入力領域全体にある種のマージンまたはパディングを適用して、丸みを帯びたエッジから遠ざける方法はありますか? または、NSView 内に NSTextView を配置し、代わりに丸みを帯びたストロークを NSView に適用するより良い方法はありますか?
- (void)drawRect:(NSRect)dirtyRect {
// Drawing code here.
[super drawRect:dirtyRect];
NSRect rect = [self bounds];
NSRect newRect = NSMakeRect(rect.origin.x+2, rect.origin.y+2, rect.size.width-3, rect.size.height-3);
NSBezierPath *textViewSurround = [NSBezierPath bezierPathWithRoundedRect:newRect xRadius:10 yRadius:10];
[textViewSurround setLineWidth:2.0];
[[NSColor whiteColor] set];
[textViewSurround stroke];
}