scrollView 上有个view,在这个view上添加的滑动手势,但每次都被scrollView截获 怎么解决
蓝色为横滑scrollView,黄色为竖滑scrollView,红色为view,要在红色上添加滑动事件
给滑动手势加上协议 在协议里面判断就行了
UIGestureRecognizerDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if(touch.view != schoolBusPage1ViewController.view
&& touch.view != schoolBusPage2ViewController.view
&& touch.view != schoolBusPage3ViewController.view)
return NO;
else
return YES;
}