iOS UICollectionView prototype cell size property ignored

后端 未结 9 1953
花落未央
花落未央 2021-01-30 19:51

I\'m using a UICollectionView with two prototype cells. The prototype cells have different widths and contain different controls (image view and web view). I\'m definitely ret

9条回答
  •  臣服心动
    2021-01-30 20:23

    Swift, working for latest iOS.

    (collectionView.collectionViewLayout as! UICollectionViewFlowLayout).itemSize = cellSize
    

    I don't have enough points to reply to Sam, but the key is that it's not UICollectionViewLayout but UICollectionViewFlowLayout.

提交回复
热议问题