• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Strategy for acting on changes in child objects?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Strategy for acting on changes in child objects?
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: catching whitespace with scanner
  • Next by Date: Re: catching whitespace with scanner
  • Previous by thread: Re: catching whitespace with scanner
  • Next by thread: Re: Strategy for acting on changes in child objects?
  • Index(es):
    • Date
    • Thread