Search code examples
cocoansbutton

Text in disabled round textured NSButton is not greyed out


I have an NSButton created in Interface Builder with the style "Round Textured". When the button is disabled, the text colour does not go grey as you would expect. Oddly enough when the button contains an image instead of text, the image does go grey, as seen in the below screenshot (top buttons are enabled, bottom buttons are disabled).

enabled and disabled buttons

How can I get the text to go grey when the button is disabled?

Update: So it gets weirder: the view containing the button is shown in a popover and every second time the view is shown the button is greyed out.


Solution

  • It seems, at least in Yosemite, as long as you set button.wantsLayer = YES on the button view, that it then works. Go figure.