NSTreeController 的“arrangedObjects”到底是什么?
我试图将 NSTreeController 的“arrangedObjects”绑定到自定义视图的“managementContent”(例如,以便它可以显示自定义轮廓)。在设置器中...
- (void)setManagedContent:(NSArray *)newManagedContentArray {
//code goes here
}
最终没有任何效果,因为 newManagedContentArray ("arrangedObjects") 显然不是 NSArray (因此我无法 addObject: 等等)相反,它显示为 NSControllerTreeProxy。我的问题是,“arrangedObjects”到底应该是什么?我应该绑定它吗?如果是这样,怎么办?
I'm trying to bind an NSTreeController's "arrangedObjects" to a custom view's "managedContent" (so that it can show a custom outline, for instance). In the setter...
- (void)setManagedContent:(NSArray *)newManagedContentArray {
//code goes here
}
nothing ends up working since newManagedContentArray ("arrangedObjects") apparently isn't an NSArray (and therefore I can't addObject: etc. etc.) Instead it's showing up as an NSControllerTreeProxy. My question is, what exactly is "arrangedObjects" supposed to be? Am I supposed to bind to it? If so, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
arrangedObjects
不应该是NSTreeController
的数组。它在文档中非常清楚地说明了这一点。您得到的是您所看到的代理对象,您可以使用childNodes
和descendantNodeAtIndexPath:
方法来获取树结构。arrangedObjects
isn't supposed to be an array forNSTreeController
. It states this quite clearly in the documentation. What you do get is the proxy object you are seeing, which you can use thechildNodes
anddescendantNodeAtIndexPath:
method on to get your tree structure.