iOS 手势冲突问题汇总(及解决办法)

一、UITableView与TouchBegan 冲突(使用手势代理解决)

首先我们先添加一个手势:

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disMissGrantureADD:)];
    [tap setNumberOfTapsRequired:1];
    tap.delegate=self;
    [self.view addGestureRecognizer:tap];

使用手势的代理进行解决

#pragma mark - UIGestureRecognizerDelegate
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
    if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {//判断如果点击的是tableView的cell,就把手势给关闭了
        return NO;//关闭手势
    }//否则手势存在
    return YES;
}


-------待更新

你可能感兴趣的:(iOS 手势冲突问题汇总(及解决办法))