Created
October 12, 2012 01:14
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.