• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: setContent: vs bind:toObject:withKeyPath:options: ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: setContent: vs bind:toObject:withKeyPath:options: ?
      • From: Keith Blount <email@hidden>
References: 
 >setContent: vs bind:toObject:withKeyPath:options: ? (From: Keith Blount <email@hidden>)

  • Prev by Date: Re: estimatedProgress: not updating
  • Next by Date: Re: estimatedProgress: not updating
  • Previous by thread: setContent: vs bind:toObject:withKeyPath:options: ?
  • Next by thread: Re: setContent: vs bind:toObject:withKeyPath:options: ?
  • Index(es):
    • Date
    • Thread