首页 > 代码库 > 子视图不响应父视图的手势识别

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

1、遵守代理 <UIGestureRecognizerDelegate>

2、实现代理方法

// 子视图不响应父视图的手势识别

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch

{

    if ([touch.view isDescendantOfView:self.TUcalendarHeaderView] || [touch.view isDescendantOfView:子试图view]) {

        return NO;

    }

    return YES;

}

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