When developing a project, I encountered a problem:
In my UIScrollViewOut, A UIScrollViewIn is embedded,
When I want to drag UIScrollViewIn, UIScrollViewOut changes, while UIScrollViewIn does not. However, you only need to press and hold UIScrollViewIn and drag it again. UIScrollViewIn will be able to slide.
How UIScrollView works:
UIScrollView reloads the hitTest method. When you touch your finger, UIScrollView intercepts all events and waits for 150 ms. During this period, if no finger is moved, when the time ends, UIScrollView sends the tracking event to the subview without moving itself. When the finger moves before the end of the time, UIScrollView slides to cancel tracking.
It seems that this is a problem with UIScrollViewOut. Drag UIScrollViewIn directly. If the touch time is less than ms, UIScrollViewOut considers it to be dragging itself, thus blocking the event. As a result, UIScrollViewIn cannot accept the sliding event. However, you only need to hold down UIScrollViewIn and drag it again. At this time, the touch time exceeds 150 ms, so the sliding event will be sent to UIScrollViewIn.
I tried several methods during this period. Only one method is feasible. It is to rewrite the hitTest method of UIScrollViewOut: When sliding UIScrollViewIn, UIScrollViewOut cannot be slide.
- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)* result = [super hitTest:point withEvent: ([result.superview isKindOfClass:[UIScrollViewIn ==
PS:
I have tried several methods, for example, changing UIScrollViewIn to firstResponder, rewriting the hitTest method in UIScrollViewOut, and always returning the UIScrollViewIn pointer.