A ScrollView is there with some SubViews....
ScrollView Contains its predefined gestures(Pan) and my custom gesture(Pan) as well and Recognize it simultaneously...
SubViews also contains custom Pan Gesture......
Everything is working fine except pan gesture on SubViews ...
When i am doing pan on SubView its SuperView also getting touches and handling that which i don't want...
When pan is being done on the subViews, the superView Should not recognize them...
How i Can Block passing my SubView gesture to its SuperView?
To block superview from responding to gesture, when there is subview under the touch point can be done as follows:
Implement the following method of UIGestureDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch;
as
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
return (touch.view == superView);
}
and set this delegate to gestureRecognizer assigned to superView.
I hope that this should do the needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With