R – viewDidAppear Not Firing in Tabbarcontroller>NavigationController>UITableView

uinavigationcontrolleruitabbarcontrollerviewdidappear

I currently have a tab bar controller set up with a navigationcontroller on one of the tabs, then I have a UITableView nib set up for that Navigationcontrollers view. All of this has been set up through IB and I want to keep it that way. Kind of like this tutorial http://twilloapp.blogspot.com/2009/05/how-to-embed-navigation-controller.html
now the view loads perfectly when ViewDidLoad is called. But when I then load further views via code IE

MyApp_AppDelegate *delegate = [[UIApplication sharedApplication] delegate];

UINavigationController *nav = (UINavigationController *)delegate.controller.selectedViewController;

newViewController = [[newViewController alloc] initWithNibName:@"newView" bundle:nil];

[nav pushViewController:newViewController animated:YES];

//At this point the view works! and loads

If I try to go back with the navigation toolbar it goes back to my previous view fine
Now I need to refresh the tableview when I go back but calling viewDidAppear does not work.

I tried adding UINavigationDelegate to the same ViewController Class as the tableview and then calling - (void)navigationController:(UINavigationController *)navigationController didShowViewController:

But that did not work. I also tried adding the same delegate as the tab bar controller and adding the same navigationController didShowViewController: there but that also failed.

How do I get this table to refresh every time the view loads?

Best Answer

You should not have to call viewDidAppear from your code. Cocoa Touch should do that for you.

Call the table view's reloadData method to get it to refresh its contents.

Related Topic