Search code examples
macoscocoaimagensbutton

NSButton with an Image


I have a question. I have a button on my .xib and a background image. I set an image to my button through the attributes inspector, but when I run the program and press the button, this happens:

If I don't press it, it looks fine. What's wrong?


Solution

  • This is controlled by the setHighlightsBy: property on the cell. It's probably set to NSChangeBackgroundCellMask by default. Try setting NSContentsCellMask (if you have an alternate 'pressed' image) or NSNoCellMask.