Skip to content

Instantly share code, notes, and snippets.

@BradB132
Last active August 29, 2015 14:22
Show Gist options
  • Save BradB132/a79ae9958889800678e8 to your computer and use it in GitHub Desktop.
Save BradB132/a79ae9958889800678e8 to your computer and use it in GitHub Desktop.
ViewControllerTransitionsPart3-2
@interface TTNavigationController ()
@property (nonatomic, weak) UIViewController* mostRecentController;
@end
// ...
- (id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
animationControllerForOperation:(UINavigationControllerOperation)operation
fromViewController:(UIViewController *)fromVC
toViewController:(UIViewController *)toVC
{
SEL selector = @selector(navigationController:animationControllerForOperation:fromViewController:toViewController:);
id<UIViewControllerAnimatedTransitioning> result = nil;
if([fromVC respondsToSelector:selector])
{
result = [(id<UINavigationControllerDelegate>)fromVC navigationController:navigationController
animationControllerForOperation:operation
fromViewController:fromVC
toViewController:toVC];
if(result)
self.mostRecentController = fromVC;
}
else if([toVC respondsToSelector:selector])
{
result = [(id<UINavigationControllerDelegate>)toVC navigationController:navigationController
animationControllerForOperation:operation
fromViewController:fromVC
toViewController:toVC];
if(result)
self.mostRecentController = toVC;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment