• 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
Bindings: is there a better way to observe when an object changes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Bindings: is there a better way to observe when an object changes?
      • From: Charles Steinman <email@hidden>
    • Re: Bindings: is there a better way to observe when an object changes?
      • From: mmalc crawford <email@hidden>
    • Re: Bindings: is there a better way to observe when an object changes?
      • From: "Shawn Erickson" <email@hidden>
  • Prev by Date: Re: custom view won't update
  • Next by Date: Re: Bindings: is there a better way to observe when an object changes?
  • Previous by thread: Re: Mach ports and namespaces
  • Next by thread: Re: Bindings: is there a better way to observe when an object changes?
  • Index(es):
    • Date
    • Thread