Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如您所知,如果您在 NSOutlineView 中单击展开元素的三角形,它会展开该元素的所有子树。但是,如果此子树包含太多元素(例如文件系统树),此操作的效果可能对您的应用程序来说是悲剧性的。问题是,如何禁用此选项单击功能?
通过将此方法添加到大纲视图委托来解决。
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldExpandItem:(id)item { return ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) == 0; }