Adjusting UICollectionView scroll speed/sensitivity
23,354
Solution 1
UICollectionView
is a subclass of UIScrollView
, so you can adjust the decelerationRate
in your collection view controller's viewDidLoad
, like so:
Objective-C:
- (void)viewDidLoad
{
[super viewDidLoad];
self.collectionView.decelerationRate = UIScrollViewDecelerationRateFast;
};
Swift:
override func viewDidLoad() {
super.viewDidLoad()
self.collectionView.decelerationRate = UIScrollViewDecelerationRateFast
}
Solution 2
For anyone looking how to do it in Swift
self.collectionView.decelerationRate = UIScrollViewDecelerationRateFast
Swift 5:
self.collectionView.decelerationRate = UIScrollView.DecelerationRate.fast
Author by
MVZ
Updated on November 19, 2020Comments
-
MVZ over 3 years
I'm trying to slow down the scroll in a UICollectionView. Everything works great and the distance between the cells is fine, but it just moves too fast.
How can I adjust the sensitivity or speed of the scroll?
[Edit] I forgot to mentioned that I already tried:
self.collectionView.decelerationRate = UIScrollViewDecelerationRateFast;
and
self.collectionView.decelerationRate = UIScrollViewDecelerationRateNormal;
With no significant change in speed...