In an iOS app, I have an UIView that contains a UIScrollView, and an overlay UIImageView with some transparency.
The overlay view is on top of the UIScrollView and has userInteractionEnabled set to YES.
I can properly receive touch events on the overlay, but the scrollview does not get them anymore.
When userInteractionEnabled si set to NO on the overlay, then I can properly pan in the UIScrollView but obviously the overlay does not get the touch events anymore.
How to be able to pass touch events from the overlay to the scrollview so I can still scroll or pan the scrollView?
I've tried this from the overlay, but it does not work:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
<...>
[myParent.myScrollView touchesMoved:touches withEvent:event];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
<...>
[myParent.myScrollView touchesBegan:touches withEvent:event];
}
Create a custom UIView class , implement this method and set it to the overlay view in IB
func point(inside point: CGPoint,
with event: UIEvent?) -> Bool {
return true
}