开发者

Drawing a rounded cornered NSTextFieldCell

开发者 https://www.devze.com 2022-12-14 08:05 出处:网络
My code for my NSTextFieldCell is: - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {

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:cellF开发者_Go百科rame angle:90];
    [[self title] drawInRect:cellFrame withAttributes:nil];

}

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消