On Wed, Feb 25, 2009 at 9:43 AM, Jon C. Munson II <jmun...@his.com> wrote:

> While it would be nice to actually see if a certain attribute got updated

  This is where a thorough understanding of KVC/KVO (with emphasis on
the KVO part) comes in. I'll point you to mmalc's examples:

http://homepage.mac.com/mmalc/CocoaExamples/controllers.html

  Check out the Graphics Bindings example. There may be other examples
that highlight what I'm about to mention, but I'm not really familiar
- the Graphics Bindings example was what really helped to seal my
understanding (after many, many hours of studying / experimenting with
ALL the relevant documentation).

  The thing to pay attention to is that, in this example, you have a
custom array controller subclass which does special things on certain
events (a key to your understanding), as well as a couple of custom
views.

  The real meat is in the view classes. Specifically to your case, the
GraphicsView class. Note how -bind:... is overridden and calls
-startObservingGraphics: (and -unbind:... calls
-stopObservingGraphics:). This is crucial because it shows how a view
that's interested in the *properties* of the objects fed to it via
bindings manages to observe specific *properties* of each bound
object.

  That is, it specifically registers interest in the properties of
each of the objects in its purview, and unregisters interest when the
object is no longer in its purview.

  The -bind: method is called from the MyDocument class, so you can
see that the @"shadowAngle" and @"shadowOffset" key paths are observed
for each graphic object.

--
I.S.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to