I have a UITapGestureRecognizer in a custom table cell which is intended to do nothing (remove the ability to tap on a cell to select it). This works great however there are some buttons (subviews) in the cell which cannot be tapped because the tap gesture handles that whole cell area.
So its as simple as detecting when the touch gesture is over one of those buttons and returning false to cancel that particular gesture, right? Well not for me …
I have removed the logic and simply returned NO in the gesture recogniser, but I still can’t tap the buttons.
- (BOOL)ignoreTap:(UIGestureRecognizer*)gestureRecognizer shouldReceiveTouch:(UITouch*)touch
{
return NO;
}
Is there something I am missing here?
The solution is more simple: you shouldn’t be using a gesture recognizer to do this. If you don’t want a cell to be selectable, you can do two things:
nilfrom-tableView:willSelectRowAtIndexPath:to make it unselectableselectionStyletoUITableViewCellSelectionStyleNoneto remove the highlight effectDoing it this way should preserve your button functionality.
Edit: if you don’t want to do that, then you can do what you were originally trying — except I think you have the method name wrong, it should be this: