Reputation: 815
I have a table in one view controller and a "+" button to add to the table. The "+" button brings you to the next view controller, which contains a dialog and a "Save" button to add a new item to the table. upon clicking the save button i use the function
[self.navigationController popViewControllerAnimated:YES];
to bring it back to the previous viewController with the table. The table does not repopulate by itself and until i go back one more view controller and then reopen (which re-initializes it)
So i was thinking i could use this function
[self.tableView reloadData];
to reload it upon opening the viewController when i have navigated backwards to it.
Is there a function that is called when a viewController is viewed after clicking the back button on the next viewController?
Any help is greatly appreciated!
Upvotes: 1
Views: 58
Reputation: 4641
It sounds like you want viewWillAppear
. UITableViewController's do some stuff already in viewWillAppear
but you need to subclass in order to have it reload the table as well.
Upvotes: 2