Create gesture recognizer like this, and add it to the view that you want it on:
UISwipeGestureRecognizer *rightSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(rightSwipe:)];
[rightSwipeGestureRecognizer setDirection:UISwipeGestureRecognizerDirectionRight];
[self.view addGestureRecognizer:rightSwipeGestureRecognizer];
define a method to handle the swipe:
-(void)rightSwipe:(UISwipeGestureRecognizer*)recognizer {
NSLog(@"Right swipe");
}
if it is still does not work, try NOT adding the recognizer to the view and see if there is another recognizer that is active..
EDIT (after seeing your code):
you have your logic inside the scrollViewDidScroll method, that is why it is reacting to any type of swipe (scroll actually). I doubt your gesture recognizer even works in this type of setup.
Gesture recognizer needs to be added to a view, then you need to connect a method that will run when gesture is recognized. Keep in mind that if you set direction of the gesturerecognizer to right, the method should only get called after right swipe.
I would review the class again, to gain full understanding on how it works. UIGestureRecognizer Class Reference
Since you are using a UIScrollView, it is a little bit more tricky to recognize a swipe, since it has it's own recognizers in place. have a look at How to recognize swipe gesture in UIScrollView
I would also suggest keeping it simple, and adding the UISwipeGestureRecognizer programmatically (most likely you don't even need to declare an instance variable for it, as the object will be returned to the @selector function on the recognizer.