Re: an oldie but a goodie: observing properties of collected objects
Re: an oldie but a goodie: observing properties of collected objects
- Subject: Re: an oldie but a goodie: observing properties of collected objects
- From: Ken Thomases <email@hidden>
- Date: Thu, 17 Jun 2010 21:02:19 -0500
On Jun 17, 2010, at 8:16 PM, Matt Neuburg wrote:
> That's pretending that "self", who owns the array, is also the one who wants
> to do the observing, that it always wants to do it, etc. Obviously that's
> easy.
>
> I'm talking about the general problem of any object registering through the
> array's vendor to get notified about changes in the array's items'
> properties. The mmalc solution (in GraphicsBinding) is clear enough -
> register for changes in the array, and register for changes in the
> properties of every item in the array individually, and then register on
> added items or unregister on removed items whenever you hear that the array
> has altered - but a beginner might find it heavy going. m.
True, my example assumed self was the observer. And, yes, that other technique is how you'd do it for other cases.
I guess it might be hard for a beginner, but these aren't really beginner-level tasks.
Also, you could probably abstract it out into a custom class to facilitate array observing, if you really wanted it. Maybe somebody already has, for all I know.
Cheers,
Ken
_______________________________________________
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