1
votes

i have a view with different subviews including a uiviewcollection, the thing is, i don't know how dynamically modify the uicollectionview height, the sizes of the cell is a fixed size, i'm just looking a way to figure out how make the uicollectionview height dynamic to show all the items, the number os items are not fixed.

Any help?

Thank you

1
This did the trick and it was super easy to implement: stackoverflow.com/a/20829728/5058757azizj

1 Answers

0
votes

You need to set height constraint of UICollectionView. Then Calculate your CollectionView height as per

(topSpacing + bottomSpacing + cellHeight) * number of cells (items)

then set heightConstraint again for your collectionview.