Re: core data, undo and redo - follow-up question
Re: core data, undo and redo - follow-up question
- Subject: Re: core data, undo and redo - follow-up question
- From: Martin Hewitson <email@hidden>
- Date: Sat, 22 May 2010 19:38:37 +0200
On May 22, 2010, at 7:25 PM, Kyle Sluder wrote:
> On Sat, May 22, 2010 at 10:20 AM, Martin Hewitson
> <email@hidden> wrote:
>> Actually, I remembered what the other problem was that 'lead me down the wrong path'. I'm observing one of the properties of the NSManagedObject, so before I remove it from the tree-controller, I stop observing the property. Now if I undo the removal, I need a place to set up the observing again.
>>
>> Can anybody recommend where I should do that? I notice that insertObject:atArrangedObjectIndexPath: of NSTreeController is not called when I undo the removal.
>
> In the undo action itself?
So I would override undo: and then try to figure out which items were re-inserted, then observe them?
> Barring that, other options depend on who's
> doing the observing. If it's controller-level code, you should
> theoretically be able to set up all your observing as objects are
> added to and removed from the controller's set of objects it controls.
Yes, it's controller-level code, in fact it's my tree-controller subclass that's doing the observing. That's why I was hoping that insertObject:atArrangedObjectIndexPath: would be called when I undo the removal, alas...
Thanks,
Martin
> If it's model-level code, that answer depends on specifics of your
> model.
>
> --Kyle Sluder
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: email@hidden
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
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