0

I am developing an IOS app. I need a functionality that includes undo and reset. It seems quite simple to perform an undo on the last operation. However I can't find any built in support for resting to the first stored undo operation.

My question is, how can I pop the first undo action and reset my view accordingly? Thank you

vondip
  • 13,809
  • 27
  • 100
  • 156

1 Answers1

1

Depending on what you're doing, the implementation might be different, but the documentation for NSUndoManager can be found here.

If you just want to undo the last group of actions, call undoNestedGroup.

If you want to undo everything, you could make a while loop that tested canUndo, and if that returned YES, called undo.

Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
  • the problem is that every undo is followed with an animation, I don't want to animate all the undo's on the list. Just the first operation stored – vondip Jul 02 '12 at 01:54
  • NSUndoManager can't do that. You'll need to implement your own way to save the state you want to go back to, and then to go back to it. – Aaron Brager Jul 02 '12 at 02:02
  • can't I just pull the first action in the UndoManager's action list? – vondip Jul 02 '12 at 02:08