Search code examples
objective-cxcodeswiftmacosnsbutton

NSButton loses blue highlight effect when setting an Alternate image


When I use a NSButton with style 'Round Rect', type 'Toggle' and an image, the image and title will be nicely rendered in blue, when the State is set to On.

However, when I also add an alternate image, this highlight effect is gone.

Is there a simple way to fix this?

I want to achieve the same effect as the small tab bar icons on top of the Inspector in Xcode: blue when selected, using an alternate image (slightly bolder), black when not selected, using the default image.


Solution

  • This is the expected behavior. The system only transforms your template to apply the visual highlight if you don't supply your own alternate (active / lit / on) version.