質問

I want to tint my button in drawRect, but cannot find the right setup to tint the image

- the button is borderless, with a grayscale image, which i want to tint

In my NSButton subclass :

- (void)drawRect:(NSRect)dirtyRect{

    if ([self.cell mouseDownFlags] == 0) {

        [[NSColor redColor] set];

    } else {

        [[NSColor blackColor] set];

    }

    NSRectFillUsingOperation(dirtyRect, NSCompositePlusDarker);

    [super drawRect:dirtyRect];
}

正しい解決策はありません

他のヒント

Try using setFill:

[[NSColor redColor] setFill];

...

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top