- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event{ UIView *hitView = [super hitTest:point withEvent:event]; if(hitView == self){ return nil; } return hitView; }
只需要在上层视图的View中添加这个代码就可以了。