I am trying to tackle a problem which sounds pretty simple: changing the background color of an NSPopupButton.
Interface Builder only allows changing the style to a pre-defined one and doesn't allow changing the background color. Also, setting up an IBOutlet
didn't help since NSPopupButton
doesn't have a setBackgroundColor
method.
I also tried subclassing NSPopupButton
to override the drawRect
method. Here's what I have tried:
- (void)drawRect:(NSRect)dirtyRect
{
[[NSColor redColor] setFill];
NSRectFill(dirtyRect);
}
This draws a red rectangle over the NSPopupButton
rather than setting it as a background color.
Any ideas on how to go about solving this?