Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS UIPanGestureRecognizer prevents scroll

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.

like image 629
boostedz06 Avatar asked Feb 26 '26 02:02

boostedz06


1 Answers

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

like image 63
Alexey Kozhevnikov Avatar answered Feb 28 '26 17:02

Alexey Kozhevnikov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!