In my app I need have a swipe gesture recogniser on my background scroller for the up direction. Here is my code below
It is in viewDidLoad
UISwipeGestureRecognizer *Swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(SwipeRecognizer:)];
Swipe.direction = UISwipeGestureRecognizerDirectionUp;
[backgroundScroller addGestureRecognizer:Swipe];
and it is the SwipeRecognizer:
- (void) SwipeRecognizer:(UISwipeGestureRecognizer *)sender {
if (sender.direction | UISwipeGestureRecognizerDirectionUp){
NSLog(@" *** SWIPE UP ***");
}
}
The problem is I cant enable scrolling and capture the gesture simultaneously. when I said scrolling is not enabled, I can recognise the gesture. But I need to to scrolling and gesture recognition simultaneously. isn’t it possible?
Override the
gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:method to don’t block the UIScrollViews Pan recognizerAnd it will work…
Dont forget to add delegate to self for gesture recogniser. As mentioned in @death7eater’s comment.