Search code examples
macoscocoatooltipnsbuttoncellnsmatrix

How to add tooltips to NSButtonCell that is within a NSMatrix


I am currently instantiating an NSMatrix w/ NSButtonCell subclasses through IB

I use the identity inspector to change the Tool Tip property

enter image description here

But the tooltip doesn't show on the button cell.

If I set a tooltip on the NSMatrix object, a tooltip still doesn't show

If I add an NSButton to the same view, and add a tooltip to that, it does show

Why won't my tooltips on NSMatrix or NSButtonCell show?


Solution

  • I don't know why it can not be set in the Interface Builder (It seems like a long standing issue), but you can set them at least programmatically.

    [self.matrix setToolTip:@"Tooltip for first item" forCell:[self.matrix cellAtRow:0 column:0]];
    [self.matrix setToolTip:@"Tooltip for second item" forCell:[self.matrix cellAtRow:1 column:0]];