On the IPad I have two different UICollectionViewCells
side by side like two columns. The first one have a width of 30% the second of 70%.
This two cells get dynamic content and have different heights. At the moment I return some static height in
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { ... }
This height is always too large.
So I want that the rows have just one height and this height is the height of the row with more content.
Is there a method how I can calculate how much height a UICollectionViewCell
needs? If not, which possibilities do I have?
I tried to generate the height by content like this
for item in contentInARow {
contentHeight += 40
}
But this 40 is too static because the content could be too big or small.
I'm thankful for some input.