How do I scale an image to fit the image representation in ios?

I put the image in an image view in xcode and set the mode to "scale to fit" but I find the image does not fit the image size. So how can I make the image fit the image size in ios?

Below is a screenshot of the storyboard.  Here is my screen shot.

+3


source to share


2 answers


Several ways to play with:



imageView.contentMode = UIViewContentMode.ScaleAspectFill
imageView.contentMode = UIViewContentMode.ScaleAspectFit

      

+2


source


To do this in your storyboard, select UIImageView

, open the Attributes inspector and choose Fill Aspect or Fit Aspect from the Mode drop-down menu.



UIImageView Content Mode

+3


source







All Articles