UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 304, SCREEN_WIDTH, SCREEN_HEIGHT)];
bgView.backgroundColor = COLOR_A(0, 0, 1, 0.5);
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hiddenBgView:)];
tap.delegate = self;
[bgView addGestureRecognizer:tap];
本类继承 UIGestureRecognizerDelegate
重写UIGestureRecognizerDelegate代理方法
#pragma mark 手势代理
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{//_tab1,_tab2,_tab3 不需要响应的子view
if ([touch.view isDescendantOfView:_tab1] ||[touch.view isDescendantOfView:_tab2]||[touch.view isDescendantOfView:_tab3]) {
return NO;
}
return YES;
}