简体   繁体   English

如何为所有Apple设备调整图像资产的大小? (不启动图像)

[英]How to resize image assets for all Apple devices? (not launch images)

My app displays 2 buttons on the top and a car picture (1 of 4 possible) at the bottom: 我的应用程序在顶部显示2个按钮,在底部显示一张汽车图片(可能为4张之一):

应用截图

Each image file has huge dimensions of 5616 x 3744 pixels and the app lags noticeably and also sometimes crashes (here fullscreen , Aspect Fill mode is used): 每个图像文件的尺寸均为5616 x 3744像素,并且该应用程序明显滞后甚至有时崩溃(在此使用全屏宽高比填充模式):

Xcode屏幕截图

So I would like to scale down the image assets and include these files (for each of the 4 car pictures) in my app: 因此,我想按比例缩小图像资源,并在我的应用程序中包含这些文件(针对4张汽车图片中的每张):

  • car.jpg car.jpg
  • car@2x.jpg car@2x.jpg
  • car@3x.jpg car@3x.jpg

After searching around and I think I have to target the Rendered Pixels sizes, that is: 经过四处搜寻之后,我认为我必须指定“ 渲染像素”大小,即:

  • 640 x 960 for iPhone 4 适用于iPhone 4的640 x 960
  • 640 x 1136 for iPhone 5 适用于iPhone 5的640 x 1136
  • 750 x 1334 for iPhone 6 iPhone 6为750 x 1334
  • 1242 x 2208 for iPhone 6 Plus iPhone 6 Plus为1242 x 2208
  • and I have yet to look up the dimensions of iPads 而且我还没有查找iPad的尺寸

However my image view has 20 pixels insets (here fullscreen ): 但是我的图像视图有20像素的插图(这里是全屏 ):

Xcode屏幕截图

So I am not sure, which value to subtract from the widths of car.jpg, car@2x.jpg and car@3x.jpg. 所以我不确定从car.jpg,car @ 2x.jpg和car@3x.jpg的宽度中减去哪个值。

Should I subtract 40 pixels from each file (that is 20 on the left and 20 on the right)? 我应该从每个文件中减去40个像素(左边20个像素,右边20个像素)吗?

只需将图像调整为最大尺寸(@ 3x)-它会比现在小得多, aspect fill将处理其余部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM