diff --git a/YSLTransitionAnimator/YSLTransitionAnimator.m b/YSLTransitionAnimator/YSLTransitionAnimator.m index 31b9afa..f71bf9a 100644 --- a/YSLTransitionAnimator/YSLTransitionAnimator.m +++ b/YSLTransitionAnimator/YSLTransitionAnimator.m @@ -40,7 +40,7 @@ - (void)animateTransition:(id)transitionCo // UIView *imageSnapshot = [fromTransitionImage snapshotViewAfterScreenUpdates:NO]; UIImageView *imageSnapshot = [[UIImageView alloc]initWithImage:fromTransitionImage.image]; imageSnapshot.layer.cornerRadius = fromTransitionImage.layer.cornerRadius; - + imageSnapshot.frame = [containerView convertRect:fromTransitionImage.frame fromView:fromTransitionImage.superview]; fromTransitionImage.hidden = YES; @@ -49,6 +49,9 @@ - (void)animateTransition:(id)transitionCo toViewController.view.frame = [transitionContext finalFrameForViewController:toViewController]; if (_isForward) { + // fix for border overlap and image distortion problem. + imageSnapshot.contentMode = fromTransitionImage.contentMode; + // push Animation toViewController.view.alpha = 0; [containerView addSubview:toViewController.view]; @@ -78,6 +81,10 @@ - (void)animateTransition:(id)transitionCo }]; } else { + // fix for border overlap and image distortion problem. + imageSnapshot.contentMode = toTransitionImage.contentMode; + imageSnapshot.clipsToBounds = YES; + // pop Animation toTransitionImage.hidden = YES; [containerView insertSubview:toViewController.view belowSubview:fromViewController.view];