iOS 降低scrollview滑动速度

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;
        }];
}

你可能感兴趣的:(iOS 降低scrollview滑动速度)