I have a best practice question regarding saving data from a UITableView.
I have a UITableView with several sections and cells, most of which I have implemented a custom UITableViewCell that displays a label when in “show” mode and a UITextField when in “edit” mode.
When the UIViewController displays the table view I populate a NSMutableDictionary with data from an object. I then use this dictionary when showing data on screen and when I update the fields. By having this buffer I can cancel the edit without having to hit core data to reload my object.
An alternative way to handle this would be to update my object directly and then if the user clicks cancel I reload the data back from SQLite.
Is there a ‘standard’ way of doing this?
Thanks, MJ
The best way I found was to use the NSUndoManager.
This way I can update my object directly and if the user hits cancel I simply undo the changes.
Works for me.
Cheers,
MJ