vPhong
vPhong

Reputation: 41

Saving UIViewController state

  1. I have a MainController with a button
  2. Click button will pushViewcontroller to UsersViewController
  3. In UsersViewController, I will load an table view of users with an selected cell to be highlighted

Ask: How could I save the state of tableview or state of the ViewController after hitting the back button from navigationcontroller, And the next time when a initiate the UsersViewController again, the table view will be at last state.

Upvotes: 0

Views: 97

Answers (2)

SilverArrow
SilverArrow

Reputation: 31

You can try to avoid using a pushViewController / Navigation Controller by using a TabBarController for example but that might change the behavior of your app.

Or avoid your UsersViewController being deallocated and just initialize it once.

Upvotes: 0

The Pedestrian
The Pedestrian

Reputation: 543

while traversing from the page, save the details in a Manager object, and next time, whenever you appear on the page, check whether the details are there in Manager object, if true, show the details from the object itself, otherwise, show them like you do as now.

Upvotes: 1

Related Questions