undo/ redo Manager - SAVE

Discussion in 'iOS Programming' started by IDMah, Jun 21, 2012.

  1. IDMah macrumors 6502

    IDMah

    Joined:
    May 13, 2011
    #1
    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
     
  2. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    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..
     
  3. IDMah thread starter macrumors 6502

    IDMah

    Joined:
    May 13, 2011
    #3
    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
     
  4. mfram macrumors 65816

    Joined:
    Jan 23, 2010
    Location:
    San Diego, CA USA
    #4
    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.
     

Share This Page