issac
issac

Reputation: 1501

UINavigationItem back problem

i have a UINavigationController in my viewcontroller,and after pushing another viewcontroller from current viewcontroller,when i press the back button on navigation bar, it return to previous view,however the previous data in the first view still there, how can i reset the first view data as like call the viewDidLoad function again when i press the back button?

Upvotes: 0

Views: 765

Answers (1)

Andrew Grant
Andrew Grant

Reputation: 58786

Instead of using viewDidLoad use -(void) viewWillAppear:(BOOL)animated

Remember that you'll be returning to the view so clear/update anything that's not applicable.

E.g;

-(void) viewWillAppear:(BOOL)animated
{
  [super viewWillAppear:animated];  

  // reload the table   
  [self.tableView reloadData];
}

Upvotes: 2

Related Questions