Binding custom views to model arrays (or trees)
Binding custom views to model arrays (or trees)
- Subject: Binding custom views to model arrays (or trees)
- From: "Oleg Krupnov" <email@hidden>
- Date: Wed, 3 Sep 2008 15:14:40 +0300
I am building a custom view that will display model objects. I am
using Core Data for the model, NSTreeController for the controller and
bindings to keep them all in sync.
I have read the "GraphicsBindings" sample, and I see that in its
overridden bind:... message, the custom view requests the sender (e.g.
the controller) for the array of model graphic objects, and then it
sends "startObservingGraphics" to self, thereby setting itself to be a
direct observer of EVERY SINGLE graphic model object in a for...in
loop. The reverse thing happens in the unbind: message.
My question is: is this the recommended way for a custom view to
observe changes in the model array?
I used to think that when a model array is observed via a controller,
such as NSArrayController or NSTreeController, it somehow gives a way
for the custom view to observe the entire array of model objects,
including not only add/remove items, but also in the array items'
properties. In other words, I hoped that when a property of any model
object in the array changes, it also notifies the array that contains
the model object, and the array fires the binding to the controller,
specifying the index (or index path) of the item that has changed, and
the key of the property that has changed. Was I wrong?
_______________________________________________
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