Handling touch event logic in a Subview or ViewController

I have a series of subclasses of UIView that are added as subzones. Each semblance can be dragged and dropped. When they are dropped (affected by Ened), I need to run the method in viewController to do some work. I currently have touchEvents in every subview class. Should I handle these touch events in the viewController, or should I pass a pointer to the parent viewController as a property of each class that I added as subviews?

UPDATE: Or is it work for NotificationCenter?

+3
source share
2 answers

UIViewController UIResponder, . UIViewController, UIView, " "; .

, -touchesEnded:withEvent:, UIViewController. - , -touchesEnded:withEvent: ( ) .

+4

uiview uiviewcontroller, . , .

MVC, , V (/ ), V, - ( ..), , C, M.

+1

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


All Articles