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.
我想清除使用 Controller.AddObject 添加的 NSTreeController 中的所有项目。这可能吗?我认为可以检索所有索引路径,按深度反向排序并逐个删除项目,但我希望有一种方法来清除数据。
只需调用setContent:您的NSTreeController.
setContent:
NSTreeController
这会删除所有内容,但无法添加新元素:
[treeController setContent:nil];
更喜欢用空集合替换它:
[treeController setContent:@[]];
根据您的型号,您可能需要对集合进行额外设置。