How to pass a tap to view depending on if dragging/scrolling or just tapping

43 Views Asked by At

I have a UIScrollView with another view behind it that has buttons. The buttons cannot be on the scroll view, they must be behind it. I am using the pointInside method to pass taps to the buttons view behind the scroll view if that is where the user is tapping. However, I don't want to pass the tap to the buttons view if the user is trying to drag/scroll. If that is the case I want it to scroll the scroll view instead of pass a tap to the buttons.

How can I accomplish this?

1

There are 1 best solutions below

1
rounak On

UIScrollView has a panGestureRecognizer property. Use the pan gesture's state to determine if you have to pass touches to your button or not.