cocoa - NSTreeController 的 "arrangedObjects"到底是什么?

标签 cocoa cocoa-bindings nstreecontroller

我正在尝试将 NSTreeController 的“arrangedObjects”绑定(bind)到自定义 View 的“managedContent”(例如,以便它可以显示自定义轮廓)。在 setter 中...

- (void)setManagedContent:(NSArray *)newManagedContentArray {
    //code goes here
}

由于 newManagedContentArray ("arrangedObjects") 显然不是 NSArray (因此我无法 addObject: 等),所以最终没有任何效果,而是显示为 NSControllerTreeProxy。我的问题是,“arrangedObjects”到底应该是什么?我应该绑定(bind)它吗?如果是这样,怎么办?

最佳答案

arrangedObjects 不应该是 NSTreeController 的数组。它在文档中非常清楚地说明了这一点。您得到的是您所看到的代理对象,您可以使用 childNodesdescendantNodeAtIndexPath: 方法来获取树结构。

关于cocoa - NSTreeController 的 "arrangedObjects"到底是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8253128/

相关文章:

cocoa - 如何验证通过 Cocoa Bindings 动态填充的菜单项

cocoa - 如何存储每个父项的子 NSTableView 设置?

objective-c - NSTreeController addChild : does not call newObject but add: does (Class/Object mode)

objective-c - 从计算机时钟引用的时间码

cocoa - NSSearchField 未按预期工作

cocoa - Cappuccino :带有可折叠行的类似 NSTableView 的组件?

cocoa - 如何自动选择插入到 NSOutlineView 和 Core Data 中的项目

cocoa - NSOutlineView 与核心数据驱动的绑定(bind)

objective-c - 是否可以在 Objective-C 中创建 "Block"对象的类别

objective-c - NSTask的标准输出可以用来生成xml文件吗