Re: [Newbie] Binding an NSArrayController with/without NSObjectController
Re: [Newbie] Binding an NSArrayController with/without NSObjectController
- Subject: Re: [Newbie] Binding an NSArrayController with/without NSObjectController
- From: Keary Suska <email@hidden>
- Date: Thu, 14 May 2009 08:55:30 -0600
On May 14, 2009, at 5:51 AM, email@hidden wrote:
Now here is what has me utterly confused and my actual question:
In his tutorial Scott is setting up an NSObjectController (named
"ControllerAlias" there) and binds that to the "MyController"
instance with the explanation:
<quote>This little green box is your "bridge" between the code in
MyController.m and the bindings system.</quote>
The two NSArrayControllers afterwards are bound to that
'ControllerAlias' NSObjectController.
Aaron in his book has me creating an NSArrayController and bind that
directly to the instance with the array to be controlled.
Essentially skipping the NSObjectController entirely. When I just
thought it was my "bridge to the bindings system"?
I would really like to understand the difference in approach between
these two methods and also if there are any implications by using or
skipping an NSObjectController in between. Would anyone find the
time and inclination to explain this to me, please?
Well, these two examples do not solve the same problem, so compare/
contrast would not be useful. You need to understand the Model-View-
Controller (MVC) pattern as it is used in Cocoa. You will find this
the docs (just search for "cocoa patterns" and I bet you'll find it
easily). NSController and its subclasses (which include
NSObjectController and NSArrayController) were designed to be the "C"
in this pattern specifically for bindings. Have you read "Cocoa
Bindings Programming Topics"?
Additional info I would add: the important difference between the two
examples is that Scott's uses a tiered approach (common for master-
detail interfaces, for instance, in their simplest form), where one
controller provides the content for another controller, while Aaron's
is the more straightforward single-controller approach (although
iterate, these aren't approaches to the same problem, but approaches
to different problems). Note also the purpose of NSObjectController vs
NSArrayController. As the name implies, the former is for binding to a
single object, while the latter is for binding to an array of objects.
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden