Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I load pictures to UIImageView keeping its original ratio?

I want to load multiple pictures to UIImageView from the Library.

However, the size and ratio of the pictures changes to UIImageView size when its loaded and

distort the original pictures.

How do I load the picture to UIImageView while keeping its original size?

like image 581
tulurira Avatar asked Dec 17 '22 05:12

tulurira


1 Answers

UIImageView does not change the images. It just offers different ways of displaying them. If you want to keep the aspect ratio intact, set the image view's contentMode property to UIViewContentModeScaleAspectFit (the default is UIViewContentModeScaleToFill).

like image 106
Ole Begemann Avatar answered Apr 23 '23 00:04

Ole Begemann