我想删除NSOutlineView
的显示/隐藏按钮。所以,我覆盖NSOutlineView
并获取mouseDown
事件。以下是代码。
-(void)mouseDown:(NSEvent *)theEvent
{
NSLog(@"LeftFolderListOutlineView mouseDown");
[super mouseDown:theEvent];
NSPoint localPoint = [self convertPoint:theEvent.locationInWindow
fromView:nil];
NSInteger row = [self rowAtPoint:localPoint];
id clickedItem = [self itemAtRow:row];
if (![clickedItem isKindOfClass:[NSDictionary class]]) {
return;
}
if ([self isItemExpanded:clickedItem]) {
[[self animator] collapseItem:clickedItem];
}else{
[[self animator] expandItem:clickedItem];
}
}
当 NSOutlineView 折叠或展开时,它应该是一个滚动动画。但在这种情况下它不起作用。有人告诉我为什么以及如何改进它?