Bindings: is there a better way to observe when an object changes?
Bindings: is there a better way to observe when an object changes?
- Subject: Bindings: is there a better way to observe when an object changes?
- From: Simone Tellini <email@hidden>
- Date: Mon, 10 Sep 2007 19:34:34 +0200
Hi,
I've created an NSView subclass which needs to be redrawn every time
an entity object changes, where "changes" means that any of its
attributes change.
I've added an "hasChanged" attribute to the entity and made it
dependent on all the other keys, using -
setKeys:triggerChangeNotificationsForDependentKey:
Then I've bound the view instance to the entity object using the
"hasChanged" key path.
I don't like this solution very much, though (for instance, I need to
remember to update the hasChanged dependancies if I add/remove an
attribute). I tried searching all over the documentation/google for a
better way to solve this problem, but I couldn't find anything useful.
Does anybody know a better way or should I stick with this
implementation?
--
Simone Tellini
http://tellini.info
_______________________________________________
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