Do I need two NSObjectControllers?
I'm learning about Cocoa bindings. I'm having two completely different objects, each with an iVar that I want to sync with a user interface item. But since they're two different ob开发者_如何学Pythonjects and I can only have on "content" outlet with one NSObjectController, do I need another one?
Yes. If you're simultaneously binding two different objects, then you need two object controllers. (It makes a sort of sense; one controller per object.)
However, if you're creating the common list view/detail view interface (as seen in Address Book), then you should only use one object controller, which should be bound to an array controller's selectedObject
. (This, too, makes sense, if you think of it as an object controller for the currently selected object, of which there is only one.)
精彩评论