Skip to content

Instantly share code, notes, and snippets.

@hamrickdavid
Created December 31, 2011 21:11
Show Gist options
  • Save hamrickdavid/1545353 to your computer and use it in GitHub Desktop.
Save hamrickdavid/1545353 to your computer and use it in GitHub Desktop.
Changing the UINavigationController animation style
CATransition *transition = [CATransition animation];
transition.duration = 0.3f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFade;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController pushViewController:nextVC animated:NO];
@interface UINavigationController (Fade)
- (void)pushFadeViewController:(UIViewController *)viewController;
- (void)fadePopViewController;
@end
@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