Skip to content

Commit

Permalink
Fix iOS 11/Xcode 9 enclosing UITableView issue
Browse files Browse the repository at this point in the history
This fixes the issue in zoonooz#76
The tableview(or scrollview) not accepting touch event for iOS 11. Caused by the new introduction of safeAreaInsets in iOS11.
  • Loading branch information
wzzhu authored Sep 24, 2017
1 parent 0d6a463 commit a82d98b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ZFDragableModalTransition/ZFModalTransitionAnimator.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a82d98b

Please sign in to comment.