tags:

views:

539

answers:

1

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?

+2  A: 

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];
}
Andrew Grant