Strategy for acting on changes in child objects?
Strategy for acting on changes in child objects?
- Subject: Strategy for acting on changes in child objects?
- From: Seth Willits <email@hidden>
- Date: Wed, 6 May 2009 22:18:16 -0700
This happens often enough that I need a real plan. I typically have
parent objects with child objects that have attributes bound to
different things in a GUI or possibly even unbound and simply modified
by something else. The parent object needs to perform some type of
action whenever one of the (possibly) many attributes of the child
object changes, such as update a file containing the data the child
represents.
I'm looking for a strategy to handle watching those changes. So far
I've used a few odd solutions which generally stem from overriding
setValue:forKey: (or each accessor explicitly depending on the
situation) in the child. I've used that to trigger an single key
(isModified) which the parent watches, post a notification, call a
delegate method, and probably some others. None of which I like.
Suggestions?
Maybe this will be covered in Erik's mystical Cocoa Patterns book :)
Thanks,
--
Seth Willits
_______________________________________________
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