Skip to content

Commit

Permalink
Fixes bugs where cancelling an interactive presentation/dismissal cau…
Browse files Browse the repository at this point in the history
…ses the from-view to be overlaid atop the to-view with user interaction disabled
  • Loading branch information
junjie committed Dec 25, 2013
1 parent 99be6bb commit 9183a88
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions AnimationControllers/CENatGeoAnimationController.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ - (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionC
}];

} completion:^(BOOL finished) {
// Bring the from view back to the front and re-disable the user
// interaction of the to view since the dismissal has been cancelled
if ([transitionContext transitionWasCancelled])
{
[transitionContext.containerView bringSubviewToFront:
fromViewController.view];
toViewController.view.userInteractionEnabled = NO;
}

fromViewController.view.layer.transform = CATransform3DIdentity;
toViewController.view.layer.transform = CATransform3DIdentity;
transitionContext.containerView.layer.transform = CATransform3DIdentity;
Expand Down Expand Up @@ -93,6 +102,15 @@ - (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionC
}];

} completion:^(BOOL finished) {
// Bring the from view back to the front and re-enable its user
// interaction since the presentation has been cancelled
if ([transitionContext transitionWasCancelled])
{
[transitionContext.containerView bringSubviewToFront:
fromViewController.view];
fromViewController.view.userInteractionEnabled = YES;
}

fromViewController.view.layer.transform = CATransform3DIdentity;
toViewController.view.layer.transform = CATransform3DIdentity;
transitionContext.containerView.layer.transform = CATransform3DIdentity;
Expand Down

0 comments on commit 9183a88

Please sign in to comment.