Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

IDMah

macrumors 6502
Original poster
May 13, 2011
317
11
Confused on how to save a Undo/Redo Manager stack?

I should be able to do this n'est–ce pas? ?

can someone point me in the right direction ? Example ??
thanks
Ian
 
You want to do a redo function for what? drawing?
Since you can save each context in an array, and when you remove, you just remove the last object contained in the array.. But you didn't really gave lot of info to go on..
 
moving card and undo redo

I have a command that move cards around in a solitaire game.
I'd like to be able to save the undo/redo for that..

So do I have to record each method (action) as well as adding it to the undo/redo manager? and then save the whole kitten-kaboodle as say NSString? Sounds painful..

but then how do I load it back into the undo manager stack??
So it behaves the same????

You can't save/Load the Undo Manager Stack some how?
Sorry even more confused?

thanks
Ian
 
You can pass the Undo Manager any kind of parameters you want. Make a little object representing a move operation if you'd like and pass that into the Undo Manager.

I just looked at the docs, and it doesn't appear the NSUndoManager follows the NSCoding protocol. So I guess you'll need to store the undo stack in your controller if you want to save the state and restore it later.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.