解决UITapGestureRecognizer 与 UITableView 点击事件冲突

添加UITapGestureRecognizer 的delegate 给当前的UIViewController

然后重写下面代理方法

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

{

    if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {

        return NO;

    }

    return  YES;

}

你可能感兴趣的:(iOS)