I want to control the image alignment when using the UIViewContentModeScaleAspectFit in UIImageView.

For example, I have two UIImageView in one view as above.these two UIImageView's contentMode is UIViewContentModeScaleAspectFit. Now I want to set image 3 to align right and image 4 to align left, so that these two images can be together.
I try to set the contentMode to UIViewContentModeScaleAspect|UIViewContentModeLeft, but it make things worse.
Any suggestions are appreciated.
Finally, I find UIImageViewAligned project which can work it out.
Thanks to @Marchy, there is also swift version UIImageViewAlignedSwift
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With