Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一张图 高度小于屏幕高度的图 放大之后 ,左右滑动,很容易切换到下一张图上,有没有什么办法可以优化 #79

Open
Lpkiki opened this issue Mar 27, 2024 · 1 comment

Comments

@Lpkiki
Copy link

Lpkiki commented Mar 27, 2024

一张图 高度小于屏幕高度的图 放大之后 ,左右滑动,很容易切换到下一张图上,有没有什么办法可以优化

@Lpkiki
Copy link
Author

Lpkiki commented Mar 27, 2024

`// delegate of gesture to let scrollView can scroll or not

  • (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
    if([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
    UIPanGestureRecognizer *pan = (UIPanGestureRecognizer *)gestureRecognizer;
    CGPoint po = [pan velocityInView:pan.view];

      if (po.y > 0 && _scrollView.contentOffset.y <= 0) {
          
          //优化
          if (_scrollView.contentSize.width > __gScreenWidth) {
              
              NSLog(@"😭😭😭😭😭😭😭😭😭😭😭😭😭😭 ");
              _scrollView.scrollEnabled = true;
              return false;
          }
          
          
          //下面是 原逻辑
          _scrollView.scrollEnabled = false;
          return true;
      }else {
          _scrollView.scrollEnabled = true;
          return false;
      }
    

    }
    return false;
    }`

解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant