Using an NSButtonCell with template image in a NSTableView

Posted by alloy on Stack Overflow See other posts from Stack Overflow or by alloy
Published on 2009-12-23T13:22:54Z Indexed on 2010/05/06 0:48 UTC
Read the original article Hit count: 437

Filed under:
|
|
|

In Interface Builder, I have set the dataCell of one of the columns of my NSTableView instance to be NSButtonCell. This works as expected, however, trying to use a ‘template’ image doesn't yield the expected visual result when clicking the button.

How I configure the NSButtonCell:

  • Image: NSRevealFreestandingTemplate
  • Scaling: None
  • Bezel: Bevel
  • Type: Momentary Push In
  • Bordered: false

Expected result when clicking the button:

  • Since the image is a ‘template’, the button should render its ‘on’ state.
  • The background, ie the space surrounding the image, should not change.

Actual result when clicking the button:

  • No difference in the ‘state’ of the rendered image.
  • The background color changes to white.

Even-though I’ve tried my best to make the explanation of the problem as concise as possible, I’ve also made a simple screencast to visually illustrate the problem. And uploaded the demo app.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about image