1.添加协议
UIGestureRecognizerDelegate
2.设置代理
self.tapRecognizer.delegate=self;
3.实现代理方法
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
if ([touch.view isDescendantOfView:_toolView]) {
NSLog(@"子视图不响应代理");
return NO;
}
return YES;
}