I have UIImageView of a random size, and I want the image to be bottom-aligned and width-scaled preserving the aspect ratio.
Blue rect is UIImageView, and filled green rect is the image. When aspect ratio (i.e. width/height) of the view is small, image occupies the bottom part of the view (left hand side image). When aspect ratio of the view is large, image gets clipped (right hand side image). Image is scaled to fill the width of the view in both cases.
How do I implement this behavior? I guess I should use
imageView.contentMode = .scaleAspectFill
which preserves aspect ratio, but how do I make the image sticked to the bottom of the view?
