I am trying to create custom animation during transition between two uiviewcontrollers. When i am trying to pop a view controller i am getting nil
object in [transitionContext containerView]
. Here is my code for custom transition class
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
{
UIViewController * toViewController = (UIViewController *)[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIViewController *fromViewController = (UIViewController *)[transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIView *containerView = [transitionContext containerView];//returns nil
[containerView addSubview:toViewController.view];
[fromViewController.view removeFromSuperview];
[transitionContext completeTransition:YES];
}
I am using similar kind of code while pushing the view controller and its working perfectly. But during pop its creating trouble.