Skip to content

Commit 9183a88

Browse files
committed
Fixes bugs where cancelling an interactive presentation/dismissal causes the from-view to be overlaid atop the to-view with user interaction disabled
1 parent 99be6bb commit 9183a88

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

AnimationControllers/CENatGeoAnimationController.m

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ - (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionC
5353
}];
5454

5555
} completion:^(BOOL finished) {
56+
// Bring the from view back to the front and re-disable the user
57+
// interaction of the to view since the dismissal has been cancelled
58+
if ([transitionContext transitionWasCancelled])
59+
{
60+
[transitionContext.containerView bringSubviewToFront:
61+
fromViewController.view];
62+
toViewController.view.userInteractionEnabled = NO;
63+
}
64+
5665
fromViewController.view.layer.transform = CATransform3DIdentity;
5766
toViewController.view.layer.transform = CATransform3DIdentity;
5867
transitionContext.containerView.layer.transform = CATransform3DIdentity;
@@ -93,6 +102,15 @@ - (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionC
93102
}];
94103

95104
} completion:^(BOOL finished) {
105+
// Bring the from view back to the front and re-enable its user
106+
// interaction since the presentation has been cancelled
107+
if ([transitionContext transitionWasCancelled])
108+
{
109+
[transitionContext.containerView bringSubviewToFront:
110+
fromViewController.view];
111+
fromViewController.view.userInteractionEnabled = YES;
112+
}
113+
96114
fromViewController.view.layer.transform = CATransform3DIdentity;
97115
toViewController.view.layer.transform = CATransform3DIdentity;
98116
transitionContext.containerView.layer.transform = CATransform3DIdentity;

0 commit comments

Comments
 (0)