How to get the rect of a UICollectionViewCell?

后端 未结 5 1837
北海茫月
北海茫月 2020-12-23 11:05

UITableView has the method rectForRowAtIndexPath:, but this does not exist in UICollectionView. I\'m looking for a nice clean way to grab a cell\'s

5条回答
  •  离开以前
    2020-12-23 11:38

    in swift 3

     let theAttributes:UICollectionViewLayoutAttributes! = collectionView.layoutAttributesForItem(at: indexPath)
     let cellFrameInSuperview:CGRect!  = collectionView.convert(theAttributes.frame, to: collectionView.superview)
    

提交回复
热议问题