iphone refresh table when view restored
I have several views that are called modally. View 1 calls View 2 and View 2 calls View 3
View 1 has a table view with data from a database.
View 3 could change the data that is shown on the table on View 1. So when View 3 and View 2 are release View 1 still shows the old data.
开发者_如何学CI assume there is a function that is available when a view is visible again? Can anyone please point me the right direction?
For example (void)viewDidLoad is triggered when its first loaded. How about when its re-displayed?
thank you!
Try adding this to your view:
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[tableView reloadData];
}
You can post notification after the data changing, then let the View 1 to update when receiving the data changing notification. Check the documentation of NSNotificationCenter
.
精彩评论