My app has 3 tabs, and the array that populates a tableView in third tab can be changed in the other two tabs. When I switch to the third tab, I need the tableView to be updated. I know how to do this, the only problem is that the table view is a check list.
When I tick some of the rows in the third tab, switch to another tab and update the 3rd tab’s array, when I want to switch back to the third tab the table is updated with the new data but the checkmarks are removed from the table.
Is there a way to update the table without removing the checkmarks?
How are you determining whether an item is checked right now? It sounds like you may not be storing the checked status of the object, and instead just setting the
accessoryTypeon the cell toUITableViewCellAccessoryCheckmark. If so you need to add a boolean property to the objects stored in the array that will represent whether that item is currently checked or not.Once you have this value stored you can use it when configuring your tableview cells(either in
tableView: cellForRowAtIndexPath:orconfigureCell: atIndexPath:or wherever else you do cell configuration) to set the appropriateaccessoryTypefor the cell.. Putting this in your cell configuration will get the tableview to correctly check items when reloading the tableview.