开发者

NSUndoManager stops undoing in certain conditions

开发者 https://www.devze.com 2023-01-14 07:41 出处:网络
Im trying to implement an undo manager in my app using Core Data. Instead of making my own UndoManager im using the default undo manager in my ManagedObjectContext. Because of that i am not registerin

Im trying to implement an undo manager in my app using Core Data. Instead of making my own UndoManager im using the default undo manager in my ManagedObjectContext. Because of that i am not registering any actions manually, neither am i beginning or ending any undo groups. Undo works fine for most conditions however at certain conditions it just halts and doesnt Undo.

I logged groupingLevel and noticed that on any action, the groupingLevel increments from 0 to 1. For any additional actions, the groupingLevel remains at 1.

If i call undo, the level decrements back to 0 and stays at 0 for further undos.

However, when I undo to开发者_如何学C certain conditions, the groupingLevel goes back to 1 and i cant undo anymore !!!!!!???

how is it possible for groupingLevel to increment when i call [[managedObjectContext undoManager] undo] ?


Nevermind, turns out my conditions were forcing the undoManager to go into an infinite loop.

0

精彩评论

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