I am trying to build undo functionality. I am using NSMutableArray as datasource for my TableView. If I do change the value in the table view and want to revert back the old value, how do I achieve it?
Suppose my initial NSMutable array elements are 1,2,3,4,5 and in table view if I change the value at row 1(assuming rows are zero indexed) from 2 to 10, my array elements become 1,10,3,4,5. How can I revert back to 1,2,3,4,5 in my array and reflect the same in table.
hi @vivekstorm,
the first simplest way that comes to mind is to create an array that holds the difference, this can be either an insert or a remove. So when you undo, you simply do the opposite and that way you will have the last state of that tableview.
There is also an NSUndoManager that you can look into for more details.