UITapGestureRecognizer doesn't tap while UIScrollView is scrolling

685 views Asked by At

Basically I have a scrollView, on which there is another view. On that view I also have a UITapGestureRecognizer.

I'm animating scrolling of the scrollView. However, during this scrolling animation, tap gesture recognizer doesn't actually recognize taps.

Any ideas?

2

There are 2 answers

0
dahiya_boy On

For best practise, you can use button action instead of UITapGesture by adding UIButton. the reason is simple, to manage the button is far much simple then the UITapGesture but I am not saying use UIButton instead of tap gesture all the time, its all about your requirement.

For your case, add this line

view.userInteractionEnabled = false

and make sure your view is added in the UITapGestureand UITapGesture method is properly implemented in your code work.

For more basic, go with these two tutorials,

First tutorial | Second tutorial

If you still face any problem then let me know.

0
Saavaj On

Without code We can't give suggestion but try with below code might be useful for you!

tapGestureRecognizer.numberOfTapsRequired = 1
tapGestureRecognizer.isEnabled = true
tapGestureRecognizer.cancelsTouchesInView = false