Reputation: 37581
I've got an image which I want to display in a UIImageView and want it to automatically resize to fit the view, and fit the screen size of the device (iPhone 4, 6, and 6+ sizes).
However I've set the view mode of the UIImageView and its parent UIView to be AspectFit but the image doesn't scale to fit the view. Why does the image not shrink to fit within the UIImageView even though the view mode is set to AspectFit?
(I"m using Xcode 6)
Upvotes: 0
Views: 1927
Reputation: 8576
Both aspect fill and aspect fit are used to size the image view to the size of the photo inside of it.
Aspect fit sizes your image so that the whole thing fits within the bounds of your image view.
Aspect fill sizes your image so that it fills up the whole image view (which can result in clipping).
More info on those definitions here.
What you most likely want to do is manually size your image view to fit the screen. The easiest way to do this might be to use something like the following, that way it will size to whatever device you're using.
[self.myImageView setFrame:self.view.bounds];
Upvotes: 0