How do I integrate popToRootViewControllerAnimated with my tabs?
- by Adam Storr
Hello!
I am trying to make one of my tab buttons go to the root using popToRootViewControllerAnimated. My question is: where do I put this code for it to work? I have my tabs created through Interface Builder... do they have to be hard coded for this to work?
Here is the code that I'm looking to use:
[self.navigationController popToRootViewControllerAnimated:YES];
New code in AppDelegate:
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
if (viewController = HomeViewController) {
[HomeViewController popToRootViewControllerAnimated:NO];
}
}