【发布时间】:2014-07-17 08:35:09
【问题描述】:
我有一个视图(在其他元素中)包含一个基于单元格的 NSTableView。我将 ViewController 设为表的代表。视图控制器以编程方式创建并添加到 NSStatusItem。
我实现了:
- (BOOL)tableView:(NSTableView *)tableView shouldShowCellExpansionForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
return YES;
}
- (NSString *)tableView:(NSTableView *)aTableView toolTipForCell:(NSCell *)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)row mouseLocation:(NSPoint)mouseLocation {
return @"A tooltip";
}
- (BOOL)tableView:(NSTableView *)tableView shouldTrackCell:(NSCell *)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
return YES;
}
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex {
NSLog(@"Display");
}
但是当我运行我的代码时,唯一被调用的方法之一是:
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex;
知道可能出了什么问题吗?
我的真正目标是动态地为我的单元格定义工具提示。
【问题讨论】:
-
嵌入视图的 NSMenuItem 是否可能正在吞噬工具提示事件?
标签: objective-c macos cocoa