Passing scroll gestures to a UIScrollView from another view

I have a view with a UIScrollView and above it there is a view displaying some text. When a user views this view, which contains text, the UIScrollView will not scroll. How to make this view transparent so that it passes swipe swipe to UIScrollView.

thanks

+4
source share
3 answers

You can just install

myTextView.userInteractionEnabled = NO; 

Or, if you create your view using Interface Builder, there is a checkbox "User interaction is enabled", just clear this check box.

+2
source

Take a look at the UIView hitTest method

Returns the farthest descendant of the recipient in the view hierarchy (including itself) that contains the specified point.

 - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event 
0
source

Inside -touchesXXXX: withEvent: methods of your custom view, call their super methods to forward touch events.

For instance:

 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { // forward touchesBegan to super class [super touchesBegan:touches withEvent:event]; ... // process touchesBegan for this view } 

Do the same for touchsMoved, touchesEnded and touchsCancelled.

-1
source

All Articles