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.
Several ways to play with:
imageView.contentMode = UIViewContentMode.ScaleAspectFill imageView.contentMode = UIViewContentMode.ScaleAspectFit
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