Receiving touch events on more than one UIView at a time

I have a bunch UIViewsstacked on top of one another (not nested). I want all of them to respond to touch, but it seems that the topmost view hides the looks below it, preventing them from receiving touch events.

At first I thought that the identifier would catch all touch events with the uppermost view, and then manually call hitTestor pointInsidein all the main views, but I found out that both methods are private (maybe?) And cannot be accessed.

Any ideas how to do this?

+3
source share
2 answers

, . , . - [self.superview sameMethod: sameParameter].

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

? ,

UITouch *touch = [touches anyObject];
[touch locationInView:self];

superView,

[self.superview touchesEnded:touches withEvent:event];
+3

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


All Articles