From 0d6a463be7a1e2e70290ae75a7ab2a57eb3dfc5c Mon Sep 17 00:00:00 2001 From: wzzhu Date: Thu, 31 Aug 2017 23:05:51 +0800 Subject: [PATCH 1/2] Fix layout error after rotation When the modal view doesn't have a zero origin bound, after rotation, the original presenting view will be set to negative frame origin. e.g., if the bounds is -20, the backViewController's view will collide with the status bar. --- ZFDragableModalTransition/ZFModalTransitionAnimator.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ZFDragableModalTransition/ZFModalTransitionAnimator.m b/ZFDragableModalTransition/ZFModalTransitionAnimator.m index 28b85ae..1b7d573 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); } From a82d98b3eceedb23f3551815a6c723387e673f89 Mon Sep 17 00:00:00 2001 From: wzzhu Date: Sun, 24 Sep 2017 10:58:52 +0800 Subject: [PATCH 2/2] Fix iOS 11/Xcode 9 enclosing UITableView issue This fixes the issue in https://github.com/zoonooz/ZFDragableModalTransition/issues/76 The tableview(or scrollview) not accepting touch event for iOS 11. Caused by the new introduction of safeAreaInsets in iOS11. --- ZFDragableModalTransition/ZFModalTransitionAnimator.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ZFDragableModalTransition/ZFModalTransitionAnimator.m b/ZFDragableModalTransition/ZFModalTransitionAnimator.m index 1b7d573..d0f2e24 100644 --- a/ZFDragableModalTransition/ZFModalTransitionAnimator.m +++ b/ZFDragableModalTransition/ZFModalTransitionAnimator.m @@ -543,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;