UITapGestureRecognizer breaks UITableView didSelectRowAtIndexPath

<UIGestureRecognizerDelegate>

UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self

                                                                                 action:@selector(handleTapGestureRecognizer:)];

    tapGesture.delegate = self;

    [self.view addGestureRecognizer:tapGesture];

#pragma mark UIGestureRecognizerDelegate methods

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

{

    if ([touch.view isDescendantOfView:_tableView]) {

        

        // Don’t let selections of auto-complete entries fire the

        // gesture recognizer

        return NO;

    }

    

    return YES;

}

Leave a comment