Re: monitoring changes in a local property
Re: monitoring changes in a local property
- Subject: Re: monitoring changes in a local property
- From: Quincey Morris <email@hidden>
- Date: Wed, 09 May 2012 21:39:09 -0700
On May 9, 2012, at 19:56 , Koen van der Drift wrote:
> In my case, the contentset of the array controller is bound to a tree controller (which is bound to the MOC of my model). I fail to see how I also bind it to an array.
Well, as to a direct answer, I'm stumped.
If the array controller is in entity mode, AFAICT there's no binding (to the data model) that would let the data model keep track of what's selected via bindings. There simply appears to be no equivalent to the "selectionIndexes" binding when in entity mode.**
So you have 2 choices that I can see:
1. Shrug and have your view controller monitor the array controller's "selectedObjects" directly.
2. Have your *app delegate* monitor the array controller's "selectedObjects", and provide the result as a public KVO-compliant property. This would keep the implementation of how the selection is determined as a private detail of the app delegate, preventing the array controller dependency from spreading throughout your application design.
** It's possible that NSArrayController maintains "selectionIndexes" when the content is a NSOrderedSet, in Lion. In that case, you can maintain (via bindings) both a tree "selectionIndexPaths" and an ordered set "selectionIndexes" property in the app delegate, then retrieve the selected "myThings" objects via a two-step lookup process. I wouldn't bet on it working, though.
_______________________________________________
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