Drawing a rounded cornered NSTextFieldCell

2019-03-01 00:32发布

My code for my NSTextFieldCell is:

- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
    // Drawing code here.
    NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor lightGrayColor] endingColor:[NSColor grayColor]];
    [gradient drawInRect:cellFrame angle:90];
    [[self title] drawInRect:cellFrame withAttributes:nil];

}

I would like to have the NSTextFieldCell to have rounded corners.... how could I do this?

1条回答
Rolldiameter
2楼-- · 2019-03-01 01:23

Use the layer property of NSView, then you can set a corner radius for this.

查看更多
登录 后发表回答