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

前端 未结 11 2268
慢半拍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:36

    UICollectionView has a method - (NSIndexPath *)indexPathForItemAtPoint:(CGPoint)point.
    This method return the index path of the item at the specified point. You could calculate the point that represents the center of the UICollectionView and then use that CGPoint and this method to retrieve the index path of the item you want to delete.

提交回复
热议问题