Getting the screen location of a cell from a UICollectionView

前端 未结 6 1523
野性不改
野性不改 2021-01-30 10:20

This isn\'t so much a question as an explanation of how to solve this problem.

The first thing to realize is that the UICollectionView does inherit from a <

6条回答
  •  感动是毒
    2021-01-30 11:14

    Well the first part of your question is pretty much clear, the second one?? anyway if what you want to get is the frame of the select cell in your collection you can use this :

    UICollectionViewLayoutAttributes *attributes = [self.collectionView layoutAttributesForItemAtIndexPath:indexPath];
    CGRect cellRect = attributes.frame;
    

    More info here

提交回复
热议问题