我想顯示鼠標懸停在NSImageCell上的工具提示。我試過在Interface Builder上設置屬性(包含NSImageCell和NSTableColumn),但它不起作用。NSImageCell:設置工具提示
任何想法?
我想顯示鼠標懸停在NSImageCell上的工具提示。我試過在Interface Builder上設置屬性(包含NSImageCell和NSTableColumn),但它不起作用。NSImageCell:設置工具提示
任何想法?
我解決了這個由控制器中重寫此方法爲我NSOutlineView:
- (NSString *)outlineView:(NSOutlineView *)outlineView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tableColumn item:(id)item mouseLocation:(NSPoint)mouseLocation;
NSCell
和NSTableColumn
都不會顯示工具提示,因爲它們都不是NSView
的子類。您將不得不在桌面視圖本身上設置工具提示。
您可以使用-[NSView addToolTipRect:owner:userData:]
爲視圖的特定區域設置工具提示。結合-[NSTableView frameOfCellAtColumn:row:]
,您應該可以爲每個單元格設置不同的值。
在NSTableView
情況下,你可以使用
(NSString *)tableView:(NSTableView *)tableView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row mouseLocation:(NSPoint)mouseLocation;