实现UIPanGestureRecognizer的代理
1、创建手势,遵守代理
panGesture.delegate = self;
[self addGestureRecognizer:panGesture];
2、实现代理方法
//保证拖动手势和UIScrollView上的拖动手势互不影响
-(BOOL)gestureRecognizer:(UIGestureRecognizer*) gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer*)otherGestureRecognizer
{
if ([gestureRecognizer.view isKindOfClass:[UIScrollView class]]) {
return NO;
}
else {
return YES;
}
}