我想將另一個collectionview(cellContentCollectionView)中的矩形轉換爲等同於我的根視圖控制器中的矩形。在swift中使用convert(_:to :)方法
用於實現此目的的實例方法是convert(_:to :),但是我在設置根視圖控制器框架中UIView的框架時遇到問題。
這裏是我迄今爲止...
cellContentCollectionView?.convert((playerLayer?.frame)!, to: fullScreenPlayerView)
cellContentCollectionView是的CollectionView,它的位於。這恰好是在collectionViewCell。
有什麼建議嗎?
轉換方法返回一個新的CGRect,你必須使用它,'讓newFrame的= cellContentCollectionView .convert?((playerLayer .frame)!到:fullScreenPlayerView)' –
什麼是第二個參數的點[到查看:UIView?]呢?我有點困惑 – Stefan
是轉換的目標視圖,視圖是你需要把你的矩形,你需要從'cellContentCollectionView'轉換'playerLayer?.frame'到'fullScreenPlayerView'座標系 –