Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set the UIImageView align left or right when set the contentMode to UIViewContentModeScaleAspectFit?

Tags:

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

enter image description here

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.

like image 578
chancyWu Avatar asked Sep 05 '13 02:09

chancyWu


1 Answers

Finally, I find UIImageViewAligned project which can work it out.

Thanks to @Marchy, there is also swift version UIImageViewAlignedSwift

like image 96
chancyWu Avatar answered Sep 18 '22 18:09

chancyWu