user2950387
user2950387

Reputation: 1

How to save the state UITableViewCell?

I have two ViewController.

In First ViewController exists UITableView

When I select the row appears Second TableView. There also have UITableView.

When you select an item in Second Tableview check mark appears  

cell.accessoryType = UITableViewCellAccessoryCheckmark;

Then when I click back Again, choose the appropriate line in the First TableView. A check mark that I set in the Second Tableview disappears.

How do I do that it did not disappear? I need to save the state.

Upvotes: 0

Views: 689

Answers (1)

Felix
Felix

Reputation: 35394

A UITableViewCell is just a view. It does not save state. You should save the state of the application into a model object at the time the second table view is getting closed. So you can restore the state from the model when needed. For simple models use container classes like NSArray or NSDictionary, for complex data structures create a NSObject subclass.

Upvotes: 2

Related Questions