Reloading a UITableView data when navigating back into a UITabBar

So i recently ran into an issue where i could not get a UITableView to reloadData – It was a view connected to the TabBar – When someone clicked Search a table was brought up, they would click a row on the table and edit the values – then click back and it should have reloaded the data – I had [tableView reloadData] in the viewWillAppear method for the View.

The trick to getting it to work is add the following code to the viewWillAppear method for the TabBar Controlling View


-(void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.selectedViewController viewWillAppear:NO];
}

This calls the viewWillAppear method for whichever view is selected.

Worked a treat for me.

Xcode, Cocoa and Objective C. Ah the joys of it all!

You can leave a response, or trackback from your own site.

Leave a Reply