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

偶尔会出现滚动一般卡住的情况 #369

Open
LiuYimin opened this issue Nov 14, 2023 · 4 comments
Open

偶尔会出现滚动一般卡住的情况 #369

LiuYimin opened this issue Nov 14, 2023 · 4 comments

Comments

@LiuYimin
Copy link

就是滚动了一半,两个Cell都显示了一半在界面上

@rgmyyw
Copy link

rgmyyw commented Dec 22, 2023

+1

1 similar comment
@PZXforXcode
Copy link

+1

@PZXforXcode
Copy link

我也遇到了这个问题,我发现是页面有其他ScorllView,然后一直滑动页面的ScrollView 加上FS自动滑动就会出现,没找到bug源头,目前我在scorllView代理暂停了 自动轮播 快结束滑动时又启动 来解决的这个问题

    //防止一直滑动导致FSpagerView 卡顿
    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
        
        if (scrollView == tableView) {
            pagerView.automaticSlidingInterval = 0
        }
        
    }
    
    func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
        
        if (scrollView == tableView) {
            pagerView.automaticSlidingInterval = 3
        }
        
    }

@PZXforXcode
Copy link

在scrollViewDidEndScrollingAnimation生命周期修正一下

 public func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) {
        if let function = self.delegate?.pagerViewDidEndScrollAnimation {
            function(self)
        }

        
        let adjustedOffset = adjustContentOffset(scrollView.contentOffset, frameWidth: self.frameWidth)
        self.collectionView.setContentOffset(adjustedOffset, animated: true)


        
    }
    
    func adjustContentOffset(_ contentOffset: CGPoint, frameWidth: CGFloat) -> CGPoint {
        let adjustedContentOffsetX = round(contentOffset.x / frameWidth) * frameWidth
        return CGPoint(x: adjustedContentOffsetX, y: contentOffset.y)
    }

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

3 participants