I have a table view with self-sizing cells where I display an image. The content mode of the image view is AspectFit, so that I can see the whole image in correct aspect ratio. The image view is constrained to the superview, but also has max height constraint.
When I have an image which is re-sized according to the content mode and therefore less high than the original size, I want the height of the image view like the re-sized image and not like the original image.
I have a sample project (see screenshot & download link below) where you see the current behaviour: The yellow and green cells have the correct top and bottom space, the blue cell is 150 pt high but it should be less to have the same top and bottom space. In the screenshot you can see that the extra top and bottom space is just empty.
Here is my sample project (Swift 3):
https://www.dropbox.com/s/16i48qnm54fktdk/Test.zip?dl=0
Does anybody has a clue how to fix this?