views:

71

answers:

1

I've got undo/redo set up in my iphone app, and now I'm looking at saving state, so when the user exits the app and then starts it up again, everything is in the same state, including the undo/redo stack. I don't see any obvious way to serialize the NSUndoManager. Is there a good way to accomplish this?

A: 

Unfortunately the stock NSUndoManager does not provide access to its internal state. The best option is to just write your own drop-in replacement undo manager, or use an open source implementation like Graham Cox's GCUndoManager. You'll get source-level access and it is reasonably simple to add NSCoding support.

Alternatively, you can try subclassing NSUndoManager to maintain your own separate, serializable undo stack in addition to its normal database.

Fnord