I've been struggling with fitting an UIImageView which shows images of variable widths and heights with Aspect Fill. The cell height is not adapting to the new height of the UIImageView and persist it's height.
The hierarchy of the views is this
- UITableViewCell
- UITableViewCell.ContentView
- UIImageView
 
 
- UITableViewCell.ContentView
I tried these scenarios in XCode Auto Layout :
- set the UIImageView => Heighttoremove at build time
- set the Intrinsic Valueof theUIImageViewtoplaceholder
- set the Intrinsic Valuefor each of theUIImageView,ContentViewandUITableViewCelltoplaceholder
With any of these combinations I get this view:
https://i.stack.imgur.com/Cw7hS.png
The blue lines represent the cell borders (boundaries) and the green ones represent the UIImageView 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). 
 
     
    