Does an ArrayController's Selection Persist Across Tabs?
I have two ArrayControllers in Interface Builder bound to two sets of Core Data entities. The two entities have a parent/child relationship. I have an NSTableView bound to the parent entities' ArrayController on the first tab of an NSTabView. The second tab of the NSTabView has another NSTableView which is bound to the child entities' ArrayController. The child ArrayController's Content Set is bound to the parent ArrayController with Controller Key: selection
and Model Key Path: <name of child relationship>
What I'm trying to do is allow the user to select an entity from the list of parents, then switch tabs and work with the list of children.
What's happening is that if I start the app with an empty storedata file, I can add parents, but cannot add children. If I add some parents, then restart the app, I can add children. The list of children, however, doesn't seem to be filtered by which parent is selected on the first tab.
The only way I can explain this behavior is if the开发者_开发百科 ArrayController's selection is not persisting across tabs, is that the case? Is there something else I'm missing?
it's possible. I've never done this myself, but it sounds like you need to experiment and see. If nothing else setting a NSTabViewDelegate http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TabView/Tasks/UsingTabViewDelegate.html and asking the controller for its selected object before and after the tab view item is selected.
I was curious myself and looked through the documentation myself, but it doesn't appear to really describe what happens to the views themselves when being selected.
精彩评论