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?
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 ;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.