我想设置NSSegmentedControl背景图像,而不是图标图像。我子类化NSSegmentedCell并重写drawSegment: inFrame: withView: function.But this works bad.How我能做到吗?
更新:我想设置半矩形的深色或浅色背景图像。
发布于 2013-06-04 16:43:55
子类化和重写drawSegment: inFrame: withView可以很好地工作
- (void)drawSegment:(NSInteger)segment inFrame:(NSRect)frame withView:(NSView *)controlView
{
NSImage* image = [NSImage imageNamed:NSImageNameBonjour];
[image drawInRect:frame fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
[super drawSegment:segment inFrame:frame withView:controlView];
}你还试过什么?
您是否在Interface Builder中正确设置了分段控件的单元格类?
https://stackoverflow.com/questions/16912625
复制相似问题