Skip to content

Instantly share code, notes, and snippets.

@zhangyuan
Created February 20, 2015 10:23
Show Gist options
  • Select an option

  • Save zhangyuan/3a24adc14f8613b12f13 to your computer and use it in GitHub Desktop.

Select an option

Save zhangyuan/3a24adc14f8613b12f13 to your computer and use it in GitHub Desktop.
UINavigationController popToRootViewController, and then immediately push a new one
// http://stackoverflow.com/questions/954982/uinavigationcontroller-poptorootviewcontroller-and-then-immediately-push-a-new
MyViewController* controller = [self.storyboard instantiateViewControllerWithIdentifier:@"MyViewController"];
UINavigationController * navigationController = self.navigationController;
[navigationController popToRootViewControllerAnimated:NO];
[navigationController pushViewController:controller animated:YES];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment