title: UICollectionView with fixed number of columns and dynamic cell height
body: <p>A lot of good info about UICollectionView is to be found, but I was unable to answer this:</p>
  
  <p>How would you go about creating a vertically scrolling UICollectionView with a fixed number of columns while the cell has dynamic height.</p>
  
  <p>My plan was to use self sizing cells but since I want a fixed number of columns that would require each cell to have a width constraint that is calculated from the collectionview width, this seems quirky and might give issues when changing device orientation. To be specific I want the collection to have on single column in compact and two in regular. </p>
  
  <p>I also tried implementing <code>collectionView(UICollectionView, layout: UICollectionViewLayout, sizeForItemAt: IndexPath) -&gt; CGSize</code> on <em>UICollectionViewDelegateFlowLayout</em> this way it's easy to set the width of the cells so it fits the number of columns I want, but it seems it's not possible to combine this with self sizing cell height.</p>