Propagation of a specific touch event to view from below

I want to implement a similar function:

View A and View B are all child views of the same parent UIView. View A and View B are sister views. View A is the same frame size as the parent view. View B is only half the size, and it is above view A. I want to capture events / gestures of banners in view B, but still distribute other events / gestures (e.g. Tap) from View B to View A. So the user is all can still interact with View A (for example, press the button on View A), while View B only captures swipe gestures.

I tried to implement the following methods in View B

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event

but it seems that all or nothing fits. since I cannot detect in these methods if the event is tap or swipe. And I did not find an API that can program a trigger on a UIView (not calling sensory methods).

+4
source share
2 answers

, , UIResponder . UIGestureRecognizer . , CancelsTocuhesInViews, , , , , UIGestureRegonizer. UIGestureRecognizerDelegate, . , , , gestureRecognizers , gestureRecognizer (_: shouldRequireFailureOf:) , ; , .

+3

, , , UIGestureRecognizer . ( ( pan?)) ( ).

, . , , , , . , , , .

+1

Source: https://habr.com/ru/post/1659787/


All Articles