Closed WynterW closed 6 years ago
解决了,将ScrollView单独分了出来,重写了- gestureRecognizerShouldBegin
方法
#import "MyScrollView.h"
@implementation MyScrollView
/**
* 重写手势,如果是左滑,则禁用掉scrollview自带的
*/
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
if([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
UIPanGestureRecognizer *pan = (UIPanGestureRecognizer *)gestureRecognizer;
if([pan translationInView:self].x > 0.0f && self.contentOffset.x == 0.0f) {
return NO;
}
}
return [super gestureRecognizerShouldBegin:gestureRecognizer];
}
@end
👍👍👍👍
我把你这种场景,更新到demo上了
框架侧滑出手势和UIScrollView横向滑动手势冲突,在设置
ScrollView.userInteractionEnabled = NO
时,侧滑手势可用。具体案例:类似QQ音乐在UIScrollView最左侧时,再滑动时唤出左侧菜单。