Re: Getting added object with KVO
Re: Getting added object with KVO
- Subject: Re: Getting added object with KVO
- From: Matt Neuburg <email@hidden>
- Date: Wed, 12 Jul 2006 10:35:41 -0700
- Thread-topic: Getting added object with KVO
On Wed, 12 Jul 2006 13:00:30 +0200, Hannes Petri <email@hidden> said:
>Okay, I think it doesn't work because I bind to
>collections.arrangedObjects. But what should I bind to instead, to
>get the functionality I want?
Hannes - I have not been following this thread, so maybe this is not the
answer you need, so please forgive me if I'm off the mark. But you seem to
be saying you need to know what the added object is whenever an object is
added in an NSArrayController.
If so, it seems to me that your mistake here is thinking that you have to do
this with bindings. Bindings don't do everything! Remember, we all lived a
very long time and very comfortably without them. What I do in a similar
situation is simply to override add: in the NSArrayController and post an
NSNotification containing a pointer to the newly added object. m.
>On 12 jul 2006, at 00.43, Hannes Petri wrote:
>
>> Hello!
>> I'm using KVO to observe an array controller, and when an object is
>> added, a view should be changed.
>> Now I want a pointer to the object that was added. How should I do?
>> Apples documentation says that I should get the index of the new
>> object, by querying the changes-dict with the key
>> NSKeyValueChangeIndexesKey, but that returns null.
>> What am I doing wrong? Is it possible to achieve what I want?
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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