On Jan 22, 2011, at 5:34 PM, Kenneth Baxter <k.b.bax...@mac.com> wrote:

> Thanks Dave. I am now trying to use an array controller. I have set up the 
> array controller and an observer on arrangedObjects, and that gets called 
> during my addition and removal of children, but the change kind is always 1, 
> and there is never anything in the old or new value arrays, so nothing beyond 
> this knows whether it was an insertion or a deletion. I'm not sure exactly 
> how much use that is in managing my other objects.

This is because of the aforementioned naughtiness of NSObjectController and 
friends. Since they ignore the options you pass to 
-addObserver:forKeyPath:options:context:, you will never get the old and new 
values even if you ask for them by providing NSKeyValueObservingOptionNew or 
NSKeyValueObservingOptionOld.

As mentioned before, for the same reason you can't use 
NSKeyValueObservingOptionPrior to work around this.

See also: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html 
(specifically, the section titled "(Missing) KVO Notification Old and New 
Values").

--Kyle Sluder
(sent from the road)
> 
_______________________________________________

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