问题描述
例如,我有 100 * 100
尺寸的图像视图或按钮,我想设置其图像或 backgroundImage
使用本地 .png
文件。根据我的理解,我需要创建3组图像,即 100 * 100
@ 1x
, 200 * 200
@ 2x
, 300 * 300
@ 3×
。我不确定我的理解是否正确,任何人都可以帮忙吗?
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 on my understanding, I need to create 3 sets of images, i.e. 100*100
for @1x
, 200*200
for @2x
, 300*300
for @3x
. I am not sure if my understanding is correct or not, can anyone help?
推荐答案
根据我的理解,如果图像尺寸 100 * 100
According to my understanding, if the image size is 100 * 100
@ 1x - > 100 * 100
@ 2x - > 200 * 200
@ 3x - > 300 * 300
有一些东西可以理解。通过创建 2x
和 3x
图像,您无法期望每个iPhone屏幕都具有完全相同的布局。屏幕与屏幕的布局不同。 1x,2x和3x图像尺寸仅处理屏幕的像素密度。
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.
假设您的图像 320 * 70
并且您正在创建
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.
这篇关于在Xcode中,图像大小应该是@ 1x,@ 2x和@ 3x?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!