Reputation: 139
I am using a tap gesture on my view which also has a table view as a subview. The table does scroll but when tapped, instead of calling didSelectRowAtIndexPath
it calls the selector associated with the tap gesture. I can detect the tapped view by getting tap location.
I want to access didSelectRowAtIndexPath
when tapped on table instead of the tap gesture selector. How do I achieve this?
Upvotes: 0
Views: 1063
Reputation: 6952
Implement the tap gesture's UIGestureRecognizerDelegate , and prevent the gesture if touch is in the tableview.
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
CGPoint p = [gestureRecognizer locationInView:view] ;
if (CGRectContainsPoint(tableview.frame, p)) {
return NO ;
}
return YES ;
}
Upvotes: 4