Get Visible IndexPath UICollectionView in Swift

前端 未结 5 1868
-上瘾入骨i
-上瘾入骨i 2021-02-07 11:02

How to get visible IndexPath while scrolling in collectionView,I referred many link1,link2 But indexPathForCell is not suppor

5条回答
  •  不思量自难忘°
    2021-02-07 11:30

    Swift, safer way to get visible Items:

    if let indexPaths = self.collectionView.indexPathsForVisibleItems {
        //Do something with an indexPaths array.
    }
    

提交回复
热议问题