Borderless NSButton turns gray when clicked

user142019 picture user142019 · Sep 26, 2010 · Viewed 12k times · Source

I am making a little application with three NSButtons with an image set. These buttons have no border nor background. However, when I click a button it turns into a gray rectangle.

How can I fix this? Thanks.

Answer

Ramaraj T picture Ramaraj T · Oct 11, 2012

Make your button type as NSMomentaryChangeButton.

[myBtn setButtonType:NSMomentaryChangeButton];

If you use NSMomentaryPushInButton then you may get gray rectangle over the button when click.