I have a UIImageView and a UILabel.
I have added leading and trailing constraints to the margin in the storyboard.
I am setting the image in the image view from an array of images each of which is of different size.
The images are aspect fit to the image view , so there is space on right and left of the image view if the image is smaller than the imageview.
How can I scale an image such that the image view resizes itself based on the size of the image and there is no empty space in the background?
I tried adding a height constraint and changing the constant value in the code . I have tried most of the solutions online , but hasn't worked.
Any help will be appreciated thank you.