Saving the state of my UITable View
i have a checklist that is on a UITable View. The user can add/delete cells and check them and uncheck them. I need some assistance with saving the state of the checklist when the page is left, becuase when the user adds a new cell, leaves the page, and returns, the table view is back in the original s开发者_如何转开发tate i had made it be in! Does someone know my problem? Thanks Guys :D -Kurt
What you appear to be missing is that adding or deleting a row from your table does not update your source array. Typically when working with a UITableview there are three steps you must perform:
- add or remove the tableview cell
- update your source array (presumably adding or deleting objects in your context)
- save your context to commit the changes
This is assuming you are using Core Data for persistent store. If you are saving in memory than you are likely done at step 2.
I suggest you review the UITableView Class reference, look over the examples and step through a tutorial before trying to stumble through the process.
精彩评论