iOS 降低scrollview滑动速度

    xiaoxiao2021-12-14  20

    1.上代码

    //设置滑动速度 self.collectionView.decelerationRate = 0; //减少自动滚动的距离 - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { [UIView animateWithDuration:1 animations:^{ targetContentOffset->x = (targetContentOffset->x - scrollView.contentOffset.x) / 5 + scrollView.contentOffset.x; targetContentOffset->y = (targetContentOffset->y - scrollView.contentOffset.y) / 5 + scrollView.contentOffset.y; }]; }
    转载请注明原文地址: https://ju.6miu.com/read-970251.html

    最新回复(0)