子视图不响应父视图的手势

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;

}

你可能感兴趣的:(子视图不响应父视图的手势)