observeValueForKeyPath and how to do it right
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