Try this one..
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([touch.view isDescendantOfView:yourview])
{
return NO;
}
return YES;
}
Pregunta
I'm trying to catch the touchesBegan
and the touchesMoved
events on an UIView.
I have a UITableView; each cell contains a UIView with several controls. One of these controls is a subclass of a UIView with code in the touchesBegan
and touchesMoved
events.
If this control is not on the tableviewcell
, then it works fine. But in this situation, all touches have effect to the tableview, but not to the UIView.
How to ignore the TouchEvents and redirect them to the UIView?
Solución 2
Try this one..
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([touch.view isDescendantOfView:yourview])
{
return NO;
}
return YES;
}
Otros consejos
Try setting delaysContentTouches
property of the tableview
(scrollview) to YES.