Instantly share code, notes, and snippets.
UINavigationController custom pop/push transition animation
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
/* | |
Copied and pasted from David Hamrick's blog: | |
Source: http://www.davidhamrick.com/2011/12/31/Changing-the-UINavigationController-animation-style.html | |
*/ | |
@interface UINavigationController (Fade) | |
- (void)pushFadeViewController:(UIViewController *)viewController; | |
- (void)fadePopViewController; | |
@end |
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
/* | |
Copied and pasted from David Hamrick's blog: | |
Source: http://www.davidhamrick.com/2011/12/31/Changing-the-UINavigationController-animation-style.html | |
*/ | |
@implementation UINavigationController (Fade) | |
- (void)pushFadeViewController:(UIViewController *)viewController | |
{ | |
CATransition *transition = [CATransition animation]; | |
transition.duration = 0.3f; | |
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
transition.type = kCATransitionFade; | |
[self.view.layer addAnimation:transition forKey:nil]; | |
[self pushViewController:viewController animated:NO]; | |
} | |
- (void)fadePopViewController | |
{ | |
CATransition *transition = [CATransition animation]; | |
transition.duration = 0.3f; | |
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
transition.type = kCATransitionFade; | |
[self.view.layer addAnimation:transition forKey:nil]; | |
[self popViewControllerAnimated:NO]; | |
} | |
@end |
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
/* | |
Copied and pasted from David Hamrick's blog: | |
Source: http://www.davidhamrick.com/2011/12/31/Changing-the-UINavigationController-animation-style.html | |
*/ | |
@interface UINavigationController (Fade) | |
- (void)pushFadeViewController:(UIViewController *)viewController; | |
- (void)fadePopViewController; | |
@end |
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
/* | |
Copied and pasted from David Hamrick's blog: | |
Source: http://www.davidhamrick.com/2011/12/31/Changing-the-UINavigationController-animation-style.html | |
*/ | |
@implementation UINavigationController (Fade) | |
- (void)pushFadeViewController:(UIViewController *)viewController | |
{ | |
CATransition *transition = [CATransition animation]; | |
transition.duration = 0.3f; | |
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
transition.type = kCATransitionFade; | |
[self.view.layer addAnimation:transition forKey:nil]; | |
[self pushViewController:viewController animated:NO]; | |
} | |
- (void)fadePopViewController | |
{ | |
CATransition *transition = [CATransition animation]; | |
transition.duration = 0.3f; | |
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
transition.type = kCATransitionFade; | |
[self.view.layer addAnimation:transition forKey:nil]; | |
[self popViewControllerAnimated:NO]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Without category: