Transmission of touch event to all subzones of the view controller

I have a view controller that creates a few oversight on top of it. All sub-items and the view controller take strokes. How can I transmit touch point information to all subzones on the screen? Keep in mind that each subview covers the entire screen, so after a few additions it looks a bit like pages in a book. That is, any subzones under the top view cannot be directly affected by the user. I tried using [self.nextResponder touchhesBegan: touches withEvent: event], however this only sends touch information from the top sub-subtext to the supervisor, bypassing all the other sub-items on the screen. Thanks

+4
source share
3 answers

I would put one more subtask on everything. This will capture all the touches that interest you and pass them back to the view controller. The controller of your view then iterates over all child UIViews, providing them with events.

i.e. sort of

for (UIView *view in subviews) [view touchesBegan:touches withEvent:event]; 

although it is assumed that all the subitems you want to pass to events are children of your view controller.

+3
source

Change your touch method only in supervisor mode. From there, iterate over all the subzones and send them the touch method.

0
source

Alternatively, you can send NSNotification to all subzones. And in the subvews class, you can have better control and can handle notifications to complete a task.

-1
source

All Articles