Change background color of NSButton

Assuming everything is hooked up in IB for your borderless button.

// *.h file
IBOutlet NSButton* myButton;

// *.m file
[[myButton cell] setBackgroundColor:[NSColor redColor]];

Note from the setBackgroundColor documentation:

“The background color is used only when drawing borderless buttons.”

If this won’t do it for you then you’ll need to override NSButton and implement the drawing yourself.

Good Luck.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)