Variable width & height of UICollectionViewCell using AutoLayout with Storyboard (without XIB)

后端 未结 3 2326
长情又很酷
长情又很酷 2021-02-19 19:05

Here is an design issue in the app that uses AutoLayout, UICollectionView and UICollectionViewCell that has automatically resizable width & height depending on AutoLayout co

3条回答
  •  你的背包
    2021-02-19 20:08

    To calculate the CollectionView cell's size dynamically, just set the flow layout property to any arbitrary value:

     let flowLayout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout
     flowLayout.estimatedItemSize = CGSize(width: 0, height: 0)
    

提交回复
热议问题