How to handle image scale on all the available iPhone resolutions?

后端 未结 8 659
悲&欢浪女
悲&欢浪女 2020-11-28 17:06

What sizes would be the best to use for images: background.png, background@2x.png and background@3x.png if we want to use this image for example to cover the full width and

8条回答
  •  我在风中等你
    2020-11-28 17:41

    For the @2x and @3x discussion, you don't really have to care about that. Care about the point size of the screen, and make sure that there are @2x assets with twice the point size and @3x assets with thrice the point size in pixels. The device will automatically pick the right one. But reading your post I guess you already know this.

    For edge-to-edge images, then unfortunately you have to make it for all screen resolutions. So, for a portrait iPhone, it would be 320 points, 375 points and 414 points, where the 414 points one would have to be @3x. A better solution may be to make your images scalable by setting up the slicing in interface builder (if you use image catalogs, that is). But, depending on the image this may or may not be an option, depending whether the image has a repeatable or stretchable part. Scalable images set up like this have very little performance impact.

提交回复
热议问题