How to find a UICollectionViewCell's coordinates relative to the App Window

后端 未结 3 671
感动是毒
感动是毒 2021-02-08 10:37

Is it possible to translate a UICollectionViewCell\'s coordinates from being relative to the UICollectionView to being relative to the superview<

3条回答
  •  清酒与你
    2021-02-08 11:11

    Just in case if anybody looking for this, here is how it can be done in Swift:

    let cellFrameInSuperview = collectionView.convertRect(collectionView.cellForItemAtIndexPath(indexPath)!.frame, toView: view)
    

提交回复
热议问题