How should I be handling, or rather NOT handling (ignoring), touches to my background view? It happens to be the view of my View Controller which has subviews (objects) that I DO want to respond to touch events. Setting userInteractionEnabled = NO for the view seems to turn off ALL interaction for the subviews as well.
I’m currently testing for
if ([[touch view] superview] == self.view)
in touchesBegan/Moved/Ended. But I’m trying to eliminate some conditional testing so looking for a better way…
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;recursively calls-pointInside:withEvent:. point is in frame coordinatesIf you override that in your background view, you can specify which subview gets hit – you can be lazy and just ask each of your subviews if they would return yes to it, and never return yourself (return nil if they all return nil). Something like: