美文网首页
iOS开发解决页面滑动返回跟scrollView左右划冲突

iOS开发解决页面滑动返回跟scrollView左右划冲突

作者: King_Liu | 来源:发表于2016-10-20 15:55 被阅读83次
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
      // 首先判断otherGestureRecognizer是不是系统pop手势
    if ([otherGestureRecognizer.view isKindOfClass:NSClassFromString(@"UILayoutContainerView")]) {
     // 再判断系统手势的state是began还是fail,同时判断scrollView的位置是不是正好在最左边
    if (otherGestureRecognizer.state == UIGestureRecognizerStateBegan && self.contentOffset.x == 0) {
        return YES;
               }
    }
     return NO;
}

相关文章

网友评论

      本文标题:iOS开发解决页面滑动返回跟scrollView左右划冲突

      本文链接:https://www.haomeiwen.com/subject/jewfuttx.html