Created
April 3, 2013 11:49
-
-
Save autresphere/5300529 to your computer and use it in GitHub Desktop.
How to handle view controller transitions with an animated: flag (http://khanlou.com/2013/03/animations-with-an-animated-flag/).
Another solution much simpler.
This file contains hidden or 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) pushViewController:(UIViewController *)viewController animated:(BOOL)animated { | |
newViewController.view.frame = //original frame | |
[self addChildViewController:newViewController]; | |
[self transitionFromViewController:oldViewController | |
toViewController:newViewController | |
duration:(animated?0.35f:0) | |
options:0 | |
animations:^{ | |
newViewController.view.frame = //new frame | |
} | |
completion:^(BOOL finished) { | |
[newViewController didMoveToParentViewController:self]; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From Apple doc for [UIViewController transitionFromViewController:toViewController:duration:options:animations:completion:]
duration: If you pass zero, the changes are made without animating them.