好吧,我明白了:http://d.pr/i/jItM
很明显我想把文字从左边移下来。我在nstextfield的子类中绘制了背景,但是我无法找到这个。
最佳答案
知道了。两者都需要重写。
- (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent
{
aRect.origin.y += 9;
aRect.origin.x += 10;
[super editWithFrame:aRect inView:controlView editor:textObj delegate:anObject event:theEvent];
}
- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(NSInteger)selStart length:(NSInteger)selLength
{
aRect.origin.y += 9;
aRect.origin.x += 10;
[super selectWithFrame:aRect inView:controlView editor:textObj delegate:anObject start:selStart length:selLength];
}