I put an image in an image view in xcode and set "scale to fit" mode, but I find that the image doesn't fit the size of the image view. So how can I make the image to fit the size of the image view in ios?
Below is the screenshot of storyboard.
To do this in your storyboard, select your UIImageView
, open the Attributes Inspector, and select either "Aspect Fill" or "Aspect Fit" from the "Mode" drop down menu.
A couple of methods to play with:
imageView.contentMode = UIViewContentMode.ScaleAspectFill
imageView.contentMode = UIViewContentMode.ScaleAspectFit
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.