Xcode界面构建器中的图像资产大小 [英] Image asset size in Xcode interface builder
问题描述
如果我将图像视图添加到Xcode的界面生成器中,并且具有200 x 100的尺寸(Xcode中的尺寸),我怎么知道将1x,2x和3x的图像资源制作成什么尺寸.
If I add an image view onto interface builder in Xcode and it has a size of 200 x 100 (size in Xcode), how do I know what size to make the image asset for 1x 2x and 3x.
如果我在Photoshop中将其设置为3x 600x300像素,然后尝试使用此图像,则在iPhone 7 plus上看起来不太清晰,所以我如何知道给定图像视图的图像资源应具有的分辨率大小
If I make it 600x300 pixels in photoshop for the 3x and then try to use this image it doesn't look very clear on an iPhone 7 plus so how do I know what resolution the image assets should be for a given image view size
推荐答案
如果我将图像视图添加到Xcode的界面生成器中,并且尺寸为200 x 100(在Xcode中为尺寸),那么我如何知道将1x,2x和3x的图像资源制作成什么尺寸.
If I add an image view onto interface builder in Xcode and it has a size of 200 x 100 (size in Xcode), how do I know what size to make the image asset for 1x 2x and 3x.
分辨率是点和像素之间的对应关系.如果所需图片尺寸为200x100点,则可以提供以下三种图片尺寸:
Resolution is a matter of the correspondence between points and pixels. If the desired image size is 200x100 points, then you would provide these three image sizes:
- 1x:200x100像素
- 2倍:400x200像素
- 3倍:600x300像素
例如,如果我们在2x分辨率的设备上运行,则将以scale
设置为2加载图像,以便2个像素对应1个点.
If we are running on, say, a 2x-resolution device, the image will be loaded with its scale
set to 2, so that 2 pixels will correspond to 1 point.
请注意,您不应不要尝试通过简单地放大1x图像来制作3x图像.那显然很可怕.您应该以600x300的原始尺寸开始和缩小比例来获取2x和1x图像.
Note that you should not attempt to make the 3x image by simply upscaling the 1x image. That will obviously look terrible. You should start with a 600x300 original and downscale to get the 2x and 1x images.
这篇关于Xcode界面构建器中的图像资产大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!