• 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: NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path?


  • Subject: Re: NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path?
  • From: Quincey Morris <email@hidden>
  • Date: Thu, 12 Jun 2008 11:19:39 -0700


On Jun 12, 2008, at 08:35, Danny Price wrote:

So the object is single-level tree where each leaf is the actual item
selected?

What I don't understand is why the same binding returns a different object
in two cases? Why don't get this proxy object when I bind the view directly
to the controller?

It looks like you're assuming that a binding involves two objects and a keypath. In fact, a binding involves two objects and *two* keypaths. The documentation for the NSKeyValueBindingCreation protocol says:


bind:toObject:withKeyPath:options:
Establishes a binding between a given property of the receiver and the property of a given object specified by a given key path.


- (void)bind:(NSString *)binding toObject:(id)observableController withKeyPath:(NSString *)keyPath options:(NSDictionary*)options

Parameters

binding
The key path for a property of the receiver previously exposed using the exposeBinding: method.


observableController
	The bound-to object.

keyPath
	A key path to a property reachable from observableController.


In your case, the two keypaths are "arrangedObjects" and "name". It is not correct (in general) to expect to be able to jam them together into a single keypath and get the same result (or any result, as you saw).


That's why there are two keypath fields to fill in when you set up the binding in IB. Confusingly, IB's display of the binding (e.g. controller.arrangedObjects.name) is a shorthand description meaningful for display purposes only.


_______________________________________________

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


References: 
 >NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path? (From: Daniel Price <email@hidden>)
 >Re: NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path? (From: Ken Thomases <email@hidden>)
 >Re: NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path? (From: Charles Srstka <email@hidden>)
 >Re: NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path? (From: "Danny Price" <email@hidden>)

  • Prev by Date: Re: Authentication and NSURLConnection sendSynchronousRequest
  • Next by Date: Re: Simple question - Subclassing NSView
  • Previous by thread: Re: NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path?
  • Next by thread: Re: NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path?
  • Index(es):
    • Date
    • Thread