Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mborromeo/344787 to your computer and use it in GitHub Desktop.
Save mborromeo/344787 to your computer and use it in GitHub Desktop.
[iPhone] Force a view to pop to its root when a UITabBarController button is pressed
// This function will force a view to pop to its root when a UITabBarController button is pressed
- (void)tabBarController:(UITabBarController *)tabBarController
didSelectViewController:(UIViewController *)viewController {
// self is Application Delegate
[[self navigationController] popToRootViewControllerAnimated:NO];
if ([viewController isKindOfClass:[UINavigationController class]]) {
[(UINavigationController *)viewController popToRootViewControllerAnimated:NO];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment