2009-12-21 53 views
1

我的代碼爲我NSTextFieldCell是:繪製一個圓角走投無路NSTextFieldCell

- (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]; 

} 

我想有NSTextFieldCell有圓角....我怎麼能做到這一點?

回答

3

使用NSView的圖層屬性,然後您可以爲此設置一個圓角半徑。

+0

我該如何設置拐角半徑? – nanochrome 2009-12-21 20:57:15

+0

controlView.layer.cornerRadius = 0.5; – Jac 2009-12-22 10:30:14