Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion YSLTransitionAnimator/YSLTransitionAnimator.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ - (void)animateTransition:(id<UIViewControllerContextTransitioning>)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;

Expand All @@ -49,6 +49,9 @@ - (void)animateTransition:(id<UIViewControllerContextTransitioning>)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];
Expand Down Expand Up @@ -78,6 +81,10 @@ - (void)animateTransition:(id<UIViewControllerContextTransitioning>)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];
Expand Down