I have a UIView demoView in a UIScrollView. I want to scroll the UIScroll view vertically and don't scroll horizontally. I add UISwipeGestureRecognizer to the UIView. The code is (self here is the UIScrollView):
self.demoView.userInteractionEnabled = YES;
UISwipeGestureRecognizer *rightSwipe = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(rightSwipeLineChart:)];
rightSwipe.direction = UISwipeGestureRecognizerDirectionRight;
[self.demoView addGestureRecognizer:rightSwipe];
UISwipeGestureRecognizer *leftSwipe = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(leftSwipeLineChart:)];
[self.demoView addGestureRecognizer:leftSwipe];
The result is I can only detect the left swipe gesture, can't detect right swipe gesture. What's wrong with my code? Thank you.