iOS解决手势冲突

设置delegate--UIGestureRecognizerDelegate


UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init]    tap.delegate = self;

[tap addTarget:self action:@selector(bgViewClick:)];    [UIView addGestureRecognizer:tap];

实现方法

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

    if (touch.view != UIView) {

        return NO;

    }

    return YES;

}


你可能感兴趣的:(原创)