itenyh
itenyh

Reputation: 1939

UISwipeGestureRecognizer conflicts with UIScrollView

The view hierarchy is like this: A normal UIView is at the bottom, and a UIScrollView is added on the bottom whose contentSize is equal to the size of the bottom view.Then, a "UISwipeGestureRecognizer" is added on the bottom view whose swipe direction is "UISwipeGestureRecognizerDirectionRight".

What I want to do is that when swipe up and down the scrollView will move and when swipe right the swipeGesture will be triggered.

But the problem is that the swipeGesture is never detected. How to solve the problem? Thanks!

Upvotes: 4

Views: 1787

Answers (1)

Willy
Willy

Reputation: 9891

Transferring itenyh's own answer to proper place.

By returning YES on the following UIGestureRecognizerDelegate's method will do the job:

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

Upvotes: 1

Related Questions