开发者

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.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜