Skip to content

Instantly share code, notes, and snippets.

@Streek
Last active December 28, 2015 13:49
Show Gist options
  • Save Streek/7510421 to your computer and use it in GitHub Desktop.
Save Streek/7510421 to your computer and use it in GitHub Desktop.
So I wanted to push a view into the navigation stack while simultaneously popping to that view (so that view slide animation goes backwards!). This was my solution. Just assumes your last navigation area is your current view and the second to last is replaced with the new view. You can easily add instead of replacing.
NSMutableArray* newViewControllers = [self.navigationController.viewControllers mutableCopy];
[newViewControllers replaceObjectAtIndex:[newViewControllers indexOfObject:self] withObject:loginController];
[self.navigationController setViewControllers:newViewControllers animated:YES];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment