diff --git a/ZFDragableModalTransition/ZFModalTransitionAnimator.m b/ZFDragableModalTransition/ZFModalTransitionAnimator.m index 28b85ae..d0f2e24 100644 --- a/ZFDragableModalTransition/ZFModalTransitionAnimator.m +++ b/ZFDragableModalTransition/ZFModalTransitionAnimator.m @@ -501,7 +501,9 @@ - (void)orientationChanged:(NSNotification *)notification { UIViewController *backViewController = self.modalController.presentingViewController; backViewController.view.transform = CGAffineTransformIdentity; - backViewController.view.frame = self.modalController.view.bounds; + CGRect bounds = self.modalController.view.bounds; + bounds.origin = CGPointZero; + backViewController.view.frame = bounds; backViewController.view.transform = CGAffineTransformScale(backViewController.view.transform, self.behindViewScale, self.behindViewScale); } @@ -541,6 +543,13 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event } CGFloat topVerticalOffset = -self.scrollview.contentInset.top; + // @available is for Xcode 9+. Can remove this if statement if not using + // Xcode 9+. + if (@available(iOS 11, *)) { + if ([self.scrollview respondsToSelector:@selector(safeAreaInsets)]) { + topVerticalOffset -= self.scrollview.safeAreaInsets.top; + } + } if ((fabs(velocity.x) < fabs(velocity.y)) && (nowPoint.y > prevPoint.y) && (self.scrollview.contentOffset.y <= topVerticalOffset)) { self.isFail = @NO;