I have a storyboard, consisting of a single UICollectionView
with multiple cells, each of varying height. The first cell takes the height from the UICollectionViewDelegateFlowLayout
:
func collectionView(collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize
.. but I'd like the second cell to be shorter.
I've placed two UIStackViews
inside a "master" UIStackView
inside the cell, and each of the inner UIStackViews
has one or more labels, like this:
cell
--> stackView (master)
--> stackView (1)
--> label
--> stackView (2)
--> label
--> label (etc)
.. in the hope that the UIStackView
would make the cell height dynamic, but it doesn't. It takes the height from the UICollectionViewDelegateFlowLayout
as before.
How should I be doing this?