uiscrollview 侧滑返回失效
self.scrollV.panGestureRecognizer.delegate = self;
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
// 开启侧滑返回功能
// 是否为平移手势
if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
// 获取平移方向
CGPoint translation = [(UIPanGestureRecognizer *)gestureRecognizer translationInView:gestureRecognizer.view];
// 向右滑动 && scrollView滑动到最左侧
if (translation.x >= 0 && self.scrollV.contentOffset.x <= 0) {
return YES;
}
}
return NO;
}
网友评论