Skip to content

Instantly share code, notes, and snippets.

@gjritter
Created October 12, 2012 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gjritter/3876791 to your computer and use it in GitHub Desktop.
Save gjritter/3876791 to your computer and use it in GitHub Desktop.
Custom segue to flip between a source and destination controller within a navigation controller
- (void) perform {
UIViewController* source = self.sourceViewController;
[UIView transitionWithView:source.navigationController.view duration:0.5f options:UIViewAnimationOptionTransitionFlipFromRight animations:^{
[source.navigationController setViewControllers:@[self.destinationViewController] animated:NO];
} completion:nil];
}
@gjritter
Copy link
Author

I'm using a custom segue with this perform method to switch between a login controller and a signup controller when the user clicks the right bar button item on the login/signup screens. It works as expected, except that the right bar button of the destination view controller doesn't become visible until the animation has completed.

For example, if the user is on the Login screen and clicks the right bar button item (which says Sign Up), it flips over to the Sign Up screen, but the button still says Sign Up until the animation is completely finished. When it finishes, the button switches to the Login button that should be present on the sign up screen.

I would have thought that the sign up controller's right bar button item would become visible as soon as the sign up controller's view became visible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment