Re: monitoring changes in a local property
Re: monitoring changes in a local property
- Subject: Re: monitoring changes in a local property
- From: Koen van der Drift <email@hidden>
- Date: Thu, 10 May 2012 06:54:18 -0400
I'm going to re-read Chapter 31 and 32 of Hillegass' book, which more or less cover this subject (view swapping and core data relations). Briefly what he does is is adding a MOC property to each view controller, so its views can use that. I'll post back later.
- Koen.
On May 10, 2012, at 12:39 AM, Quincey Morris wrote:
> 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