
如何隐藏显示/hide按钮(在这里编辑为展开)。即使我将其设置为空字符串,数据单元格的边框也会缩小,如图所示。之前我使用的方法是- (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item,它隐藏了显示/隐藏字符串,并且工作得很好。但问题是,大纲视图只允许展开,而不允许折叠。我希望通过单击相应的父节点,一次只展开一个父节点。
发布于 2013-05-16 13:21:49
最终解决了这个问题,this code帮了我。
- (NSRect)frameOfOutlineCellAtRow:(NSInteger)rowIndex
{
NSRect superFrame = [super frameOfOutlineCellAtRow:rowIndex];
// Return NSZeroRect if the row is a group row
if ([[self delegate] respondsToSelector:@selector(outlineView:isGroupItem:)]) {
if ([[self delegate] outlineView:self isGroupItem:[self itemAtRow:rowIndex]]) {
return NSZeroRect;
}
}
return superFrame;
}发布于 2014-09-12 23:34:39
在NSOutlineViewDelegate方法中使用此方法:
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item;https://stackoverflow.com/questions/16579138
复制相似问题