UISwipeGestureRecognizer conflicts with UIScrollView

The hierarchy of views looks like this: the normal UIView is at the bottom, and at the bottom at the bottom, a UIScrollView is added, the contentSize of which is equal to the size of the bottom view. Then, in the bottom view, "UISwipeGestureRecognizer" is added whose direction of movement is "UISwipeGestureRecognizerDirectionRight".

What I want to do is that when scrolling up and down the scrollView will move, while when scrolling to the right the swipeGesture is triggered.

But the problem is swipeGesture is never detected. How to solve a problem? Thank!

+3


source to share


1 answer


Transferring itenyh own answer to the right place.

Returning YES

to the following method UIGestureRecognizerDelegate

will do the job:



- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}

      

0


source







All Articles