title: UIImageView with Aspect Fill inside custom UITableViewCell using AutoLayout
body: <p>I've been struggling with fitting an <code>UIImageView</code> which shows images of variable widths and heights with <code>Aspect Fill</code>. The cell height is not adapting to the new height of the <code>UIImageView</code> and persist it's height.</p>
  
  <p>The hierarchy of the views is this</p>
  
  <ul>
  <li>UITableViewCell
  <ul>
  <li>UITableViewCell.ContentView
  <ul>
  <li>UIImageView</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>I tried these scenarios in XCode Auto Layout :</p>
  
  <ul>
  <li>set the <code>UIImageView =&gt; Height</code> to <code>remove at build time</code></li>
  <li>set the <code>Intrinsic Value</code> of the <code>UIImageView</code> to <code>placeholder</code></li>
  <li>set the <code>Intrinsic Value</code> for each of the <code>UIImageView</code>, <code>ContentView</code> and <code>UITableViewCell</code> to <code>placeholder</code></li>
  </ul>
  
  <p>With any of these combinations I get this view:</p>
  
  <p><a href="http://i.stack.imgur.com/Cw7hS.png">http://i.stack.imgur.com/Cw7hS.png</a></p>
  
  <p>The blue lines represent the cell borders (boundaries) and the green ones represent the <code>UIImageView</code> border (boundaries). There are four cells in this example, the 1st and the 3rd ones have no images and the 2nd and the 4th ones have the same image (overflowing over the ones which have none). </p>