Search code examples
iosiphoneuiimageviewxcasset

Issues with image assets and iOS phones


I want to have a 60x60 UIImageView that displays my logo on the login screen.

In my image assets, I have the 60x60 .png in 1x and 120x120 .png in 2x. However, whenever I display these images something just seems a tad off. There seems to be the slightest but obvious blur.

I decided to test out the 120x120 image as a 3x image for the iPhone 6 Plus and was shocked to find that it looked perfect and wasn't blurry at all. This doesn't seem to add up to me since 120x120 pixels is not 3 times as much as 60x60.

Maybe I just don't understand how the image assets work, but how would I get this to all mesh properly?


Solution

  • You could try changing the content mode, maybe try UIViewContentModeCenter.

    Another option would be to check the storyboard and, if you are using constraints, not set any width/height constraints on your UIImageView. This will make the image view resize to fit the asset set inside.