I have a list of objects displayed in an NSTableView (bound to an NSArrayController). When you select an object in that list I want to show a detail view in a second NSTableView. My object has an array property. I can't figure out how to wire the bindings for this. binding to NSArrayController's selection doesn't work, as that's a single object, and NSTableView expects to be bound to an array...
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Create a second NSArrayController
and bind its contents to the first controller using a keypath of selection.<name of your object's array property>
.
So, if your first table view is displaying objects of class Person
and your Person
class has a children
property, you would bind the second array controller to selection.children
.
You need a separate array controller for each array that you want to manage in a table view.