I have a complex view hierarchy controlled by an UIViewController. I'm looking for a simple way to inform the controller about all touches happening inside the hierarchy, even those that are handled by subviews. I don't want to intercept them, I just want to be informed开发者_运维问答 about them.
And subclassing all views in the hierarchy is not really an option.
Thanks!
Subclass root view in your controller and implement hitTest:withEvent:
method in it:
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
UIView *result = [super hitTest:point withEvent:event];
// Your custom code
return result;
}
精彩评论