What should image sizes be at @1x, @2x and @3x in Xcode?

后端 未结 5 810
轮回少年
轮回少年 2020-11-29 17:47

For example, I have a 100*100 size imageview or button, and I want to set its image or backgroundImage with a local .png file. Based o

相关标签:
5条回答
  • 2020-11-29 18:27

    According to my understanding, if the image size is 100 * 100

    @1x -> 100 * 100

    @2x -> 200 * 200

    @3x -> 300 * 300

    There is something to understand. By creating 2x and 3x images, you can't expect exact same layout from each iPhone screen. The layout will be different from screen to screen. 1x, 2x and 3x image sizes dealing with only the pixel density of the screen.

    Suppose you have an image which is 320 * 70 and you are creating

    @1x -> 320 * 70

    @2x -> 640 * 140

    @3x -> 960 * 210

    This will be your output in different screens.

    0 讨论(0)
  • 2020-11-29 18:38

    Use the assets catalog. Xcode will manage the @1x, @2x, @3x easilly, and tell you the dimensions for the images.

    With it it's easy to manage the AppIcon and LaunchScreen images.

    0 讨论(0)
  • 2020-11-29 18:42

    For @3x image increase @1x image size by 3 times!

    e.g.

    15 x 15 = @1x

    30 x 30 = @2x

    45 x 45 = @3x

    OR

    100 x 100 = @1x

    200 x 200 = @2x

    300 x 300 = @3x

    OR

    15 x 10 = @1x

    30 x 20 = @2x

    45 x 30 = @3x

    I hope this is helpful to you!

    0 讨论(0)
  • 2020-11-29 18:45

    Yes, you are right. But if you are using Assets you can do it all in one image with three slots for it

    0 讨论(0)
  • 2020-11-29 18:51

    Yes, your understanding is correct.

    A standard resolution image has a scale factor of 1.0 and is referred to as an @1x image. High resolution images have a scale factor of 2.0 or 3.0 and are referred to as @2x and @3x images. Suppose you have a standard resolution @1x image that’s 100px × 100px, for example. The @2x version of this image would be 200px × 200px. The @3x version would be 300px × 300px.

    For more details you can check this link https://developer.apple.com/ios/human-interface-guidelines/graphics/image-size-and-resolution/

    0 讨论(0)
提交回复
热议问题