美文网首页
限制scrollView可触摸滚动的区域

限制scrollView可触摸滚动的区域

作者: 开洋_shen | 来源:发表于2018-10-26 17:37 被阅读0次
    • (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
      UIView view = [super hitTest:point withEvent:event];
      BOOL hitHead = point.y < (NNHeadViewHeight - self.offset.y);
      if (hitHead || !view) {
      self.scrollEnabled = NO;
      if (!view) {
      for (UIView
      subView in self.subviews) {
      if (subView.frame.origin.x == self.contentOffset.x) {
      view = subView;
      }
      }
      }
      return view;
      } else {
      self.scrollEnabled = YES;
      return view;
      }
      }

    相关文章

      网友评论

          本文标题:限制scrollView可触摸滚动的区域

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