Horizontal UIScrollView having vertical UIScrollViews inside - how to prevent scrolling of inner scroll views when scrolling outer horizontal view?

后端 未结 6 899
失恋的感觉
失恋的感觉 2021-02-09 18:50

couldn\'t find a solution for that.

I am building an app, with big scroll view, who has paging (Horizontal). Inside this scroll view, there is a grid of UIView\'s, and a

6条回答
  •  别跟我提以往
    2021-02-09 19:01

    I think using velocity to determine the scroll direction is a better way:

    - (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer {
        CGPoint velocity = [gestureRecognizer velocityInView:gestureRecognizer.view];
        return fabs(velocity.y) > 3 * fabs(velocity.x);
    }
    

提交回复
热议问题