2

I have 1x, 2x and 3x images in image assets file like below mentioned image.

Image 1

But, it were placed 1x image for all devices like below mentioned image.

Image 2

Am using Xcode 7.3 and iOS 9.3. I created imageview using auto layout. And set Align centre x to superview and Align centre Y to superview.

Any advice / input would be appreciated! Thanks.

Muthu Sabarinathan
  • 1,198
  • 2
  • 21
  • 49

3 Answers3

7

This is fine. 3x doesn't mean that your imageview will show three time bigger. It's uses three time bigger resolution. That means if your imageview's size is 50x50 then iphone 6 plus (5.5 inch) requires image with resolution 150x150. If you set 50x50 resolution image to this display then it will not show perfact. That's it. It doesn't mean that 3x image will display 3 time larger then original imageview.

Then also you need your imageview of your size of your image then set UIViewContentModeScaleAspectFill content mode to your imageview with same constraints specified in question!

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75
2

As @Lion answered this question very well, using 3X does not means your image height and width will increase 3 times.

If you want to resize your image view for bigger device so all you need is to use appropriate autolayout constrains.

follow this if you want to change origin and size of image view with device size(aspect ratio) And when your size of imageview resize, use the 2/3 times bigger image as imageview for 2X/3X resolution.

Autolayout: origin and size should change according to width and height factor

Check these devices

iPhone 4 and prior @1X

iPhone 4S,5,5S,5C,6,6S,7,7S @2x

iPhone 6+,6S+,7+,7S+ @3x

suppose after applying constraints for bigger screen your image view's size is (50,50) then use a image of size 150,150 for 3X resolution

Mayank Jain
  • 5,663
  • 7
  • 32
  • 65
1

Make sure your content mode is UIViewContentModeScaleAspectFill and there are no height/width constraints for your UIImageView

atulkhatri
  • 10,896
  • 3
  • 53
  • 89