我想在 drawRect 中为我的按钮着色,但找不到正确的设置来为图像着色
- 按钮是无边框的,带有灰度图像,我想着色
在我的 NSButton 子类中:
- (void)drawRect:(NSRect)dirtyRect{
if ([self.cell mouseDownFlags] == 0) {
[[NSColor redColor] set];
} else {
[[NSColor blackColor] set];
}
NSRectFillUsingOperation(dirtyRect, NSCompositePlusDarker);
[super drawRect:dirtyRect];
}