RE: [Q] What causes an NSArrayController to know that an entity was inserted via a different window?
RE: [Q] What causes an NSArrayController to know that an entity was inserted via a different window?
- Subject: RE: [Q] What causes an NSArrayController to know that an entity was inserted via a different window?
- From: "Jon C. Munson II" <email@hidden>
- Date: Wed, 25 Feb 2009 10:38:18 -0500
- Organization: JTA Enterprises LLC
Thanks for that, I will take a look at it, and study it, and study it some
more...
Peace, Love, and Light,
/s/ Jon C. Munson II
> -----Original Message-----
> From: I. Savant [mailto:email@hidden]
> Sent: Wednesday, February 25, 2009 10:36 AM
> To: email@hidden
> Cc: cocoa-dev
> Subject: Re: [Q] What causes an NSArrayController to know that an entity
> was inserted via a different window?
>
> On Wed, Feb 25, 2009 at 9:43 AM, Jon C. Munson II <email@hidden> 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 (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