Reputation: 519
I am developing a project for iOS, using storyboard for setting up the views.
If I have a UIViewController
with some UIButtons
, all of the same size.
Lets say 100 points width and 75 points height.
I have a variety of images, of all kinds of shapes, but all falling within this [100 width / 75 height] rectangle.
I want the images to keep their original size, shape & quality. So I guess I want to use center and/or aspect fit for content mode.
Is this the correct mode?
But aspect fit is especially needed, when an image is bigger then the UIButton
, right?
What if the image is a fraction bigger then the [100 width / 75 height] rectangle, and I use aspect fit for content mode. This will 'scale down' the image to the size of the UIButton
, right? Will the quality of the image decrease then? If yes, can this be a big decrease, or just marginal?
Upvotes: 0
Views: 766
Reputation: 244
content mode Aspect Fit
is always best choice while placing image anywhere in iOS
Upvotes: 1
Reputation: 10182
I want the images to keep their original size, shape & quality. So I guess I want to use center and/or aspect fit for content mode. Is this the correct mode?
If you want button to change it's frame according to image then you should get image.size
and update the frame of the button.
But aspect fit is especially needed, when an image is bigger then the UIButton, right?
Right!
What if the image is a fraction bigger then the [100 width / 75 height] rectangle, and I use aspect fit for content mode. This will 'scale down' the image to the size of the UIButton, right?
Right!
Will the quality of the image decrease then? If yes, can this be a big decrease, or just marginal?
Quality of image decrease when you scale up a Image. So Scaling down does;t make a big impact on image (if scaled in ratio).
Upvotes: 1