Skip to content

Instantly share code, notes, and snippets.

@paulstefanort
Created October 5, 2012 16:43
Show Gist options
  • Save paulstefanort/3840912 to your computer and use it in GitHub Desktop.
Save paulstefanort/3840912 to your computer and use it in GitHub Desktop.
UINavigationController - switch directly from one view to another
// (http://stackoverflow.com/questions/410471/how-can-i-pop-a-view-from-a-uinavigationcontroller-and-replace-it-with-another-i)
// locally store the navigation controller since
// self.navigationController will be nil once we are popped
UINavigationController *navController = self.navigationController;
/* Not necessary with ARC
// retain ourselves so that the controller will still exist once it's popped off
[[self retain] autorelease];
*/
// Pop this controller and replace with another
[navController popViewControllerAnimated:NO];
[navController pushViewController:someViewController animated:NO];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment