Reputation: 149
Is there a way in iOS to know if a UICollectionView is scrolling or not?
I want to know it because I'm loading in every UICollectionCell an image downloaded from the Web, but if the Collection View is big and I scroll until the end it starts downloading every image and if I change view I must wait that previous download, this slow down the app and is not cool, lol :D
Thanks and sorry for my English ;)
Upvotes: 9
Views: 17491
Reputation: 4437
As the previous post mentions, UICollectionView
inherits from UIScrollView
, so I think you can just check a couple UIScrollView
methods:
BOOL isScrolling = (cv.isDragging || cv.isDecelerating);
Edit: As the comment have mentioned, the API is now:
BOOL isScrolling = (cv.dragging || cv.decelerating);
Upvotes: 23
Reputation: 3023
For Swift
let isScrolling: Bool = colView.isDragging || colView.isDecelerating
Upvotes: 5
Reputation: 21
This may help you out since UICollectionView inherits from UIScrollView https://stackoverflow.com/a/19061527/2916429
Upvotes: -1