FSPagerView icon indicating copy to clipboard operation
FSPagerView copied to clipboard

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

Open LiuYimin opened this issue 7 months ago • 4 comments

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

LiuYimin avatar Nov 14 '23 07:11 LiuYimin

+1

rgmyyw avatar Dec 22 '23 03:12 rgmyyw

+1

PZXforXcode avatar May 06 '24 01:05 PZXforXcode

我也遇到了这个问题,我发现是页面有其他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 avatar May 06 '24 02:05 PZXforXcode

在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)
    }

PZXforXcode avatar May 08 '24 09:05 PZXforXcode