当我们在ViewController中有scrollView的时候, 可能会遇到右滑无法响应返回手势, 有以下解决办法:

  自定义scrollView, 实现该scrollView的以下方法即可:

@implementation GOfflineContentScrollView

 

-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer

{

    // 首先判断otherGestureRecognizer是不是系统pop手势

    if ([otherGestureRecognizer.view isKindOfClass:NSClassFromString(@"UILayoutContainerView")]) {

        // 再判断系统手势的statebegan还是fail,同时判断scrollView的位置是不是正好在最左边

        if (otherGestureRecognizer.state == UIGestureRecognizerStateBegan && self.contentOffset.x == 0) {

            return YES;

        }

    }

    return NO;

}

 

@end

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2021-08-19
  • 2021-07-04
猜你喜欢
  • 2021-04-16
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
相关资源
相似解决方案