Re: setContent: vs bind:toObject:withKeyPath:options: ?
Re: setContent: vs bind:toObject:withKeyPath:options: ?
- Subject: Re: setContent: vs bind:toObject:withKeyPath:options: ?
- From: Camillo Lugaresi <email@hidden>
- Date: Wed, 28 Dec 2005 19:09:14 +0100
On 28/dic/05, at 16:46, Keith Blount wrote:
I have several NSArrayControllers, and to bind their
contents programmatically, all I have to do is call
-setContent:. However, this does not seem to work with
NSTreeController.
It doesn't work with NSArrayController, either. Setting the content
is not the same as binding the content property: when you do the
former, you hand the controller an array and it adds and removes
objects directly; when you do the latter, it uses KV accessors to ask
the object to which it is bound to manipulate the property whose key
is specified in the binding. At least, that's how I'm using it. :-)
After trying various different
approaches, I finally realised that the only way to
bind the content of an NSTreeController
programmatically was by calling [treeController
bind:@"contentArray" toObject:self
withKeyPath"rootNodes" options:nil].
I don't have much experience with Cocoa bindings, but I'm pretty sure
that the bind:toObject:withKeyPath:options: method is the normal way
to establish bindings programmatically. Why are you so surprised that
in order to set up a binding you have to call a method called "bind"?
Camillo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden