my requirement is when i swipe from right of the screen(viewcontroller A) then need to push to next viewcontroller(viewcontroller B) using interactive transition.Use the same mechanism for dismiss also, when i swipe from left of the screen(viewcontroller B) it dismiss the controller using interactive transition. How can wen implement it in right way .I have implemented dismiss a viewcontroller using interactive transition but can't able to implement pushing to a viewcontroller using interactive transition
#import "AMSimpleAnimatedDismissal.h"
@implementation AMSimpleAnimatedDismissal
-(NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext
{
return 1.5f;
}
-(void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
{
UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
[[transitionContext containerView]addSubview:toVC.view];
CGRect toFrame = toVC.view.frame;
CGRect initialFrame = fromVC.view.frame;
toVC.view.frame = CGRectMake(-320 ,0, CGRectGetWidth(toFrame) , CGRectGetHeight(toFrame));
CGRect finalFrame = CGRectMake(initialFrame.size.width, initialFrame.origin.y, initialFrame.size.width, initialFrame.size.height);
UIViewAnimationOptions opts = UIViewAnimationOptionCurveLinear;
[UIView animateWithDuration:1.0 delay:0 options:opts animations:^{
fromVC.view.frame = finalFrame;
toVC.view.frame = CGRectMake(0, 0, CGRectGetWidth(fromVC.view.frame), CGRectGetHeight(fromVC.view.frame));
} completion:^(BOOL finished) {
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
}];
}
these are my line of code for interactive transition section