• 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
observeValueForKeyPath and how to do it right
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

observeValueForKeyPath and how to do it right


  • Subject: observeValueForKeyPath and how to do it right
  • From: Chris Idou <email@hidden>
  • Date: Mon, 22 Dec 2008 18:19:43 -0800 (PST)

I've got a NSTableView controlled by a NSArrayController using content set binding. One of the columns is a checkbox, and I need to take some action when the user changes the value, but I don't want to put the code in the actual object, because it would be beyond the concerns of this object to deal with all that.

So what is the right way to go about this? Do I need to use observeValueForKeyPath on every individual object in the NSArrayController? If so, where should I put the code? Should I bind to the contentSet of the object whose contentSet the ArrayController is bound to, so I get updated when the ArrayController is updated? Or should I also override the add: and remove: methods of the ArrayController to add and remove observers individually? If I put it in the former, do I need to make sure I'm not observing the same object more than once?





      Stay connected to the people that matter most with a smarter inbox. Take a look http://au.docs.yahoo.com/mail/smarterinbox
_______________________________________________

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: observeValueForKeyPath and how to do it right
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: Replacing objects
  • Next by Date: Re: observeValueForKeyPath and how to do it right
  • Previous by thread: Re: Debugging memory smashers with GC
  • Next by thread: Re: observeValueForKeyPath and how to do it right
  • Index(es):
    • Date
    • Thread