Re: Binding to a controller in a different nib
Re: Binding to a controller in a different nib
- Subject: Re: Binding to a controller in a different nib
- From: Randall Meadows <email@hidden>
- Date: Thu, 28 Feb 2008 11:23:52 -0700
Responding to my own post, for clarification...
On Feb 28, 2008, at 10:47 AM, Randall Meadows wrote:
In my main window (which resides in it's own nib, and is controlled
by a custom window controller), I have a combobox. I'd like to
populate the contents of that via bindings.
In my main nib file is where the controller lives that maintains the
information that I want to populate that combobox with. This
controller has a dictionary ("infoDictionary"), and the keys of that
dictionary are what I want displayed in the combobox.
My main window class has a member variable (I'm calling this
"infoController") that is a link to that information controller.
So, I attempted to set up the binding on the combobox as:
Ok, so I created an NSArrayController object in my window's nib file,
connected that to an outlet in my window class. In awakeFromNib: I
grab the keys from the infoController's infoDictionary, and pass that
to the array controller via addObjects:. It successfully populates my
combobox's content (now I just gotta work on selecting the right one).
Is this the correct way to do this? To me, it seems like a long-
winded route to get there, but then, I think that a LOT about
bindings. Is this just due to my inexperience with bindings? Or do I
just need to keep drinking the kool-aid until it eventually clicks?
(Or, are bindings *really* that roundabout?)
Thanks!
randy
_______________________________________________
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