Re: Bindings: is there a better way to observe when an object changes?
Re: Bindings: is there a better way to observe when an object changes?
- Subject: Re: Bindings: is there a better way to observe when an object changes?
- From: Charles Steinman <email@hidden>
- Date: Mon, 10 Sep 2007 10:55:20 -0700 (PDT)
--- Simone Tellini <email@hidden> wrote:
> 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:
>
> [SNIP]
>
> 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).
This is the normal solution as far as I know. If you
really want *all* attributes of the entity to trigger
the notification, you could just get them from
NSEntityDescription rather than listing them yourself,
but you're pretty much doing it the normal way. Out
of curiosity, other than needing to remember to update
the list of attributes that are considered "changes,"
are you finding any other problems with this approach?
Cheers,
Chuck
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell.
http://searchmarketing.yahoo.com/
_______________________________________________
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