0
votes

I have a header view with a logo on the left which I want to be both left aligned and "Aspect Fit" scaled such that the image is as tall as possible in the available area. If I set the mode to "Left" then it does left align but the small image does not scale up. If I set the mode to "Aspect Fit" then it scales up perfectly, but it is centered in the imageview with padding on the sides. I have tried adding an inequality for the width in autolayout but it has no effect. If I increase the content hugging priority of the imageview, then the image is displayed at its smallest size with no scaling up.

How can I have the image scaled up and also remove the padding around the image?

Here is my test layout: image layout

2

2 Answers

3
votes

Set the mode to "Aspect Fill" and try it again.

0
votes

Set mode to Aspect Fill and resize your UIImageView to image size.