7

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 ;)

4

3 回答 3

22

正如上一篇文章提到的,UICollectionView继承自UIScrollView,所以我认为你可以检查几个UIScrollView方法:

 BOOL isScrolling = (cv.isDragging || cv.isDecelerating);

编辑:正如评论所提到的,API现在是:

BOOL isScrolling = (cv.dragging || cv.decelerating);
于 2014-12-15T08:48:01.043 回答
5

对于斯威夫特

let isScrolling: Bool = colView.isDragging || colView.isDecelerating
于 2018-11-29T06:11:58.373 回答
0

这可能会对您有所帮助,因为 UICollectionView 继承自 UIScrollView https://stackoverflow.com/a/19061527/2916429

于 2013-11-14T16:21:56.230 回答