Objective c 如何动态更新NSTreeController和NSOutlineView?
展开大纲视图项时-Objective c 如何动态更新NSTreeController和NSOutlineView?,objective-c,macos,cocoa,nsoutlineview,nstreecontroller,Objective C,Macos,Cocoa,Nsoutlineview,Nstreecontroller,展开大纲视图项时- (void) outlineViewItemDidExpand:(NSNotification *)notification -,我能够成功地将对象添加到TreeController(日志语句将新添加的对象显示在层次结构的正确位置),但OutlineView/UI没有更新以反映该插入 没用,我用了 [self.outlineView重载项:无重载子项:是] [self.outlineView重载数据],甚至 [self.outlineView setHidden:YES
(void) outlineViewItemDidExpand:(NSNotification *)notification
-,我能够成功地将对象添加到TreeController(日志语句将新添加的对象显示在层次结构的正确位置),但OutlineView/UI没有更新以反映该插入
没用,我用了
[self.outlineView重载项:无重载子项:是]
,甚至[self.outlineView重载数据]
然后[self.outlineView setHidden:YES]
[self.outlineView setHidden:否]
这一切都是在Objective-C中以编程方式完成的。6小时后,我明白了 我需要更新NSTreeController缓存,这是通过
重新排列对象
方法实现的
因此,我的问题的答案是:
[self.cloudDirectoryTreeController rearrangeObjects];
6个小时后,我明白了 我需要更新NSTreeController缓存,这是通过
重新排列对象
方法实现的
因此,我的问题的答案是:
[self.cloudDirectoryTreeController rearrangeObjects];
您是使用绑定还是仅使用
NSOutlineViewDataSource
-协议方法?我对值、大纲视图内容和索引路径(NSOutlineView)以及内容数组/控制器内容(NSTreeView)使用绑定。我使用的唯一委托是:-(void)outlineViewItemDidExpand:(NSNotification*)通知您使用绑定还是只使用NSOutlineViewDataSource
-协议方法?我对值、大纲视图内容和索引路径(NSOutlineView)以及内容数组/控制器内容(NSTreeView)使用绑定。我使用的唯一委托是:-(void)outlineViewItemDidExpand:(NSNotification*)通知