3
votes

I am overriding my horizontal image UIScrollView with a panning gesture recognizer to detect a user swipe.

UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureCaptured)];
[imgHorizontalScrollView addGestureRecognizer:panGesture];

My question is: Is there a way for me to reset imgHorizontalScrollView's pan gesture recognizer back to default in the panGestureCaptured method? The reason I ask is because since I am overriding this gesture, once the user swipes and the gesture is picked up, I am no longer able to scroll in the scroll view. I also tried to remove the gesture but that also prevents me from being able to scroll.

2

2 Answers

8
votes

try UIGestureRecognizerDelegate gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: with scrollView's gestureRecognizer got by panGestureRecognizer

0
votes

Try setting

panGesture.cancelsTouchesInView = NO;

If that doesn't work, you should find a way to change your gesture handler to the scrollViewDidScroll: delegate method