解决方法是设置代理 UIGestureRecognizerDelegate
然后再设置你的手势 tap 代理为self
tap.delegate=self;
接着实现以下方法
Object-C:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([touch.view isDescendantOfView:你想屏蔽掉手势的子视图]) {
return NO;
}
return YES;
}