当前位置: 动力学知识库 > 问答 > 编程问答 >

objective c - NSOutlineView and weird extra tooltip

问题描述:

In the datasource of my NSOutlineView I implement the method -toolTipForItem or something similar. It returns the appropriate NSString that should be displayed in the tooltip of the specified row.

The problem is that whenever I scroll, while the tooltip is being displayed, it shows yet another tooltip. This one from the NSTextFieldCell inside the outlineview. How do I disable that one. The cell is subclassed and I have disabled the exteriorFrame drawing in order to get rid of it, but now its just an empty box.

网友答案:
- (void)drawWithExpansionFrame:(NSRect)cellFrame inView:(NSView *)view
{
    // no implementation
}

- (NSRect)expansionFrameWithFrame:(NSRect)cellFrame inView:(NSView *)view 
{
    // fix the extra tooltip
    return NSZeroRect;
}

It only happens when the text inside the cell is being truncated, its trying to compensate for it by showing the tooltip. Disable with the code above.

分享给朋友:
您可能感兴趣的文章:
随机阅读: