NSTextField

  • 设置光标颜色
#import "MYTextField.h"
@implementation MYTextField

- (void)drawRect:(NSRect)dirtyRect {
    [super drawRect:dirtyRect];
    [(NSTextView*)[self currentEditor] setInsertionPointColor:[NSColor blueColor]];
}

@end
  • 去掉选中时蓝色边框


    NSTextField_第1张图片
NSTextField_第2张图片
  • 设置stringValue时如果为nil,会 Crash,要做判空处理.
textField.stringValue = newAppPath ? newAppPath : @"";

你可能感兴趣的:(NSTextField)