Core Data: consequences of disabling the undoManager
Core Data: consequences of disabling the undoManager
- Subject: Core Data: consequences of disabling the undoManager
- From: Brian Williams <email@hidden>
- Date: Fri, 8 Feb 2008 14:31:38 -0800 (PST)
Hi am looking for a bit of design / api advice.
I am working on a drawing application (of sorts) that uses Core Data to store
the objects, and I am using Core Animation for the presentation layer. I have a
controller that updates both the UI objects and the managed objects, so that
they are in sync.
I have had big problems with CD and undo. The core of the problem is that when
undo/redo happens I have no idea what happened, so my controller can't do it's
job. I tried to observe the managed objects, but it was too difficult to get
fine grained notifications of the changes, and more importantly if you undo to
a time before the object existed your observer is gone.
I have tried throwing away the entire view graph and rebuilding when undo
happens, but that (as you can Imagine) doesn't work so well :)
SO, I am thinking that I will forgo the life fulfilling connivence that is
magic undo support and undo it my self.
What is the safest way to turn off undo in Core Data?
I have tried setting the managedObjectContext's undoManager to nil in the
persistantdocuement init.
This appears to work, but my document seems to be out of sync when I save, or
worse sometimes its completely empty! I guess this is not the safest thing to
do.
If I use a different undo manager then I have to make the menu items function
nicely, I guess that's not a big deal. Will this also cause problems?
Any advice appreciated.
Thanks
Brian
_______________________________________________
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