开发者

disableUndoRegistration is still allowing undo operations

I want to disable undo registration for an operation on an NSManagedObject but it still records the operation even though I explicitly call disableUndoRegistration.

Is there something obvious I am missing?

I also tried to enable/disable in the viewWillAppear and viewWillDisappear methods, respectively.

Here is some example code...

#pragma mark -
#pragma mark NotesViewControllerDelegate methods
 - (void)notesViewController:(NotesViewController *)controller didFinishWithSave:(BOOL)save
{
 开发者_StackOverflow中文版   if (save)
    {
        [undoManager disableUndoRegistration];
        [book setNotes:[controller getDataFromText]];
        [undoManager enableUndoRegistration];
    }
}


You have to call [managedObjectContext processPendingChanges]; before each of the calls that disable and enable the undo registration because Core Data queues changes to be able to do optimizations.

see http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜