我正在尝试在NSImageCell上显示鼠标悬停时的工具提示。我尝试在接口生成器上(在NSImageCell和包含该属性的NSTableColumn上)设置该属性,但不起作用。
有什么想法吗?
发布于 2011-07-22 05:30:49
我通过在我的NSOutlineView的控制器中覆盖这个方法解决了这个问题:
- (NSString *)outlineView:(NSOutlineView *)outlineView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tableColumn item:(id)item mouseLocation:(NSPoint)mouseLocation;发布于 2011-06-29 06:42:47
NSCell和NSTableColumn都不会显示工具提示,因为它们都不是NSView的子类。您必须在表视图本身上设置工具提示。
可以使用-[NSView addToolTipRect:owner:userData:]为视图的特定区域设置工具提示。结合使用-[NSTableView frameOfCellAtColumn:row:],您应该能够为每个单元设置一个不同的单元。
发布于 2014-04-08 19:33:53
对于NSTableView,您可以使用
(NSString *)tableView:(NSTableView *)tableView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row mouseLocation:(NSPoint)mouseLocation;https://stackoverflow.com/questions/6513755
复制相似问题