Re: Listening to bindings
Re: Listening to bindings
- Subject: Re: Listening to bindings
- From: James McConnell <email@hidden>
- Date: Fri, 18 Feb 2005 18:56:00 -0600
On 2/18/05 10:00 AM, "Guy English" <email@hidden> wrote:
> On Fri, 18 Feb 2005 10:46:06 +0000, email@hidden
> <email@hidden> wrote:
>> Are there notifications I can listen for as they relate to my array?
> You can observer the array yourself.
> http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_class
> ic/Protocols/NSKeyValueObserving.html
>
> The plan would be to observe the array and all it's content objects.
>
> On add to the array, start observing the newly added objects (you'll
> get a set of 'me in the observe notification method)
>
> On remove from the array, stop observing the removed objects (again,
> you'll get a a set)
>
> For each object in the array observe all the keys you're interested in
> serializing. You probably want to ask the object you're observing for
> a set of keys it serializes and observe those.
>
> My question would be ... why? Is there some reason your model objects
> can't manage this themselves? You know when one of your models gets
> created ( init ) you know when it gets deleted ( dealloc ) and you
> know when it's state changes ( through accessors ). Why do you want a
> third party sticking it's nose in there? The only thing I can think of
> is that you're using NSDictionaries instead of actual model classes -
> if you are: don't. :)
>
> Guy
This seems to be exactly what I'm looking for. I have an AppController that
contains the base array for my NSArrayController. I simply need to set
AppController to observe this base array of objects. Thank you so much for
the info, and I seemed to have sparked a nice little conversation. Glad I
could be of assistance. :-)
James
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden