how to get indexPath for cell which is located in the center of UICollectionView

前端 未结 11 2243
慢半拍i
慢半拍i 2020-12-25 09:41

How can i find indexPath for cell in the middle of UICollectionView?

I have horizontal scrolling and only one big cell<

11条回答
  •  南方客
    南方客 (楼主)
    2020-12-25 10:23

    Based on @micantox answer. Updated code for Swift 5

    let initialPinchPoint = CGPoint(x: collectionView.center.x + collectionView.contentOffset.x,
                                    y: collectionView.center.y + collectionView.contentOffset.y)
    

提交回复
热议问题