Re: Undo in conjunction with core data
Re: Undo in conjunction with core data
- Subject: Re: Undo in conjunction with core data
- From: Kyle Sluder <email@hidden>
- Date: Sat, 22 Jan 2011 17:49:49 -0800
On Jan 22, 2011, at 5:34 PM, Kenneth Baxter <email@hidden> 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 (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