I've got a view that has two subviews:
- Subview A, a UIView (contains other views, which contain UIButtons, views with gesturerecognizer …)
- Subview B, a UIScrollView (contains some views, but has transparent regions).
The scrollview is on top of Subview A and has the full device width/height. I want the user to be able to interact – through the transparent regions – with all those buttons and gesture reconizers below the scrollview, while still being able to scroll (so passing on the hittest is out).
Seems like an easy enough task, but I can't get it to work. The scrollview is always blocking all touches.
Any idea how I would accomplish that? Thanks!
Best Solution
You should subclass the UIScrollView and overwrite the following method:
If this method returns NO the scrollview will be "transparent" for touch events.
As you want the scrollview to be "transparent" for touch events only if the touch is in a transparent area of your scrollview, your implementation should look like: