Check whether cell at indexPath is visible on screen UICollectionView

后端 未结 4 854
春和景丽
春和景丽 2021-02-19 18:44

I have a CollectionView which displays images to the user. I download these in the background, and when the download is complete I call the following func to update

4条回答
  •  独厮守ぢ
    2021-02-19 19:47

    Get current available cells

    // get visible cells 
    let visibleIndexPaths = followedCollectionView.indexPathsForVisibleItems
    

    Then check if your indexPath is contained in the visibleIndexPaths array or not, before doing anything with cells.

提交回复
热议问题