Re: Unobserved Changes
Re: Unobserved Changes
- Subject: Re: Unobserved Changes
- From: Keary Suska <email@hidden>
- Date: Fri, 22 Feb 2008 11:24:22 -0700
- Thread-topic: Unobserved Changes
on 2/22/08 2:45 AM, email@hidden purportedly said:
> [container addObserver: self forKeyPath: @"characteristics.myarray" options:
> 0 context: NULL];
AFAIK, you can't observe changes to the *contents* of an array using the
above; you can only observe when the array object itself is replaced. If,
however, you observe the arrangedObjects property of the array controller,
you will get notified when objects are added or removed.
> I have a NSArrayController object set up to manage changes by a user to the
> NSMutableArray object through a table view. I also have a button that, when
> clicked, adds a row to the table. Such a change to the array does not seem
> to be sending a "changed" message to the observer (the ContainerController
> object). I am pretty sure that I've followed the KVO criteria regarding this
> array object. How should I set this up so that my ContainerController object
> will be notified when an element is added to the array?
You may have followed KVO, but did you follow KVC, and hence have indexed
accessors? If so, then you can trap additional and deletions, and even
replacements if you implemented the optional accessor.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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