Search code examples
cocoauser-interfaceinterface-builderappkitnsbutton

Borderless NSButton turns gray when clicked


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.


Solution

  • Make your button type as NSMomentaryChangeButton.

    [myBtn setButtonType:NSMomentaryChangeButton];
    

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