项目中使用了GMGridView,可是这个view是在一个横向的scrollview中,结果上下滑动GMGridView的时候,左右也可以滑动
看了下GMGridView的源码,加入这两段代码即可解决这个问题,如果有重复的方法,就替换掉
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if([touch.view isKindOfClass:[UIControl class]]) {
return NO;
}
return YES;
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
if ([gestureRecognizer isKindOfClass:[NSClassFromString(@"UIScrollViewPanGestureRecognizer") class]]) {
return NO;
}
return YES;
}