Search code examples
swiftmacoscocoatableviewtooltip

NSTableView toolTipFor cell - How to display tooltips for cells?


I have a view-based TableView, the delegate Outlet of the TableView is set to my ViewController. My ViewController implements the NSTableViewDelegate protocol and has the method toopTipFor cell method implemented. However, If I hover the mouse over any cell, no tooltip is displayed and the method is not even called.

I have created a small sample XCode project, you can download it here: https://ranger81.de/_sub/temp/ToolTipTest.zip

Here is a code snippet:

code snippet

Thank you very much!


Solution

  • tableView(_:toolTipFor:rect:tableColumn:row:mouseLocation:) is only valid for NSCell-based table views. Implement the tooltip in the cell view or its subviews.