UIGestureRecognizer *_sigleTap;
_sigleTap = [[UIGestureRecognizer alloc]initWithTarget:self action:@selector(hidePop:)];
[self.view addGestureRecognizer:_sigleTap];
[self.view addSubview:_popView];
最简单的解决方法是让你的类继承 UIGestureRecognizerDelegate
然后再设置你的手势_sigleTap 代理为self接着实现以下方法
Object-C:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([touch.view isDescendantOfView:你想屏蔽掉手势的子视图]) {
return NO;
}
return YES;
}