title: UICollectionView cell subviews do not resize
body: <p>In a <code>CollectionView</code>, some cells should have an additional subview or layer. The <code>CollectionView</code> can be told to resize it's cells, thus all content needs to resize appropriately.</p>
  
  <p>Currently, the cell is initialized from a nib containing a cell with imageview; the cell nib is linked to a custom <code>UICollectionViewCell</code> subclass, that only does the init. Autoresize subviews is checked.</p>
  
  <p>The <code>CollectionView</code> is told to resize the cell by a value derived and returned in <code>sizeForItemAtIndexPath:</code>. I have subclassed a FlowLayout but it only specifies <code>ScrollDirection</code> and <code>Insets</code>.</p>
  
  <p>All of that is working fine. Problem: How do I add subview/layer to the cell so it also resizes correctly? I tried adding subviews and layers with <code>translatesAutoresizingMaskIntoConstraints</code> off, but these do not automatically change size at all. Also tried to use code frame/view instead of nib. </p>
  
  <p>The best I got now is a <code>cell.contentView.layer</code> sublayer which I add in <code>cellForItemAtIndexPath:</code>; that is "manually" resized by storing the cell's <code>frame.size</code> from <code>sizeForItemAtIndexPath:</code>, which is not only ugly but also ends up with the sublayer having various sizes for different cells.</p>
  
  <p>Any help appreciated!</p>