title: How to make UICollectionViewCell fit its subviews (using Auto Layout)
body: <p>How can I change the size of a <code>UICollectionViewCell</code> based on the size of its subviews, using Auto Layout?</p>
  
  <p>My <code>UICollectionViewCell</code>s each only have one view in their <code>contentView</code>. This is a custom <code>UIView</code> subclass of mine that automatically resizes itself to fit all its subviews using Auto Layout. It also implements <code>-intrinsicContentSize</code> correctly. However the <code>UICollectionView</code>, or rather its layout, do not seem to care about this.</p>
  
  <p>I am using a <code>UICollectionViewFlowLayout</code>, and tried:</p>
  
  <ul>
  <li>Leaving the <code>itemSize</code> at its default value. This gives me cells with a size of 50 x 50.</li>
  <li>Implementing the delegate method <code>-collectionView:layout:sizeForItemAtIndexPath:</code>. However, when this method gets called, the cells (obviously) have not appeared on screen yet, and have not been updated by the Auto Layout system.</li>
  </ul>
  
  <p>Is there any way to change my cells' size based on their subviews using the standard Apple classes?  Or do I have to implement my own <code>UICollectionViewLayout</code> subclass, or something else?</p>