【发布时间】:2014-01-15 14:45:30
【问题描述】:
我想在 drawRect 中为我的按钮着色,但找不到正确的设置来为图像着色
- 按钮是无边框的,带有灰度图像,我想对其进行着色
在我的 NSButton 子类中:
- (void)drawRect:(NSRect)dirtyRect{
if ([self.cell mouseDownFlags] == 0) {
[[NSColor redColor] set];
} else {
[[NSColor blackColor] set];
}
NSRectFillUsingOperation(dirtyRect, NSCompositePlusDarker);
[super drawRect:dirtyRect];
}
【问题讨论】:
标签: macos cocoa nsimage nsbutton nsbuttoncell