简体   繁体   English

iOS Image Asset大小调整。 3倍实际上是1倍大小的3倍,是否需要Retina 4 2倍?

[英]iOS Image Asset sizing. Is 3x actually 3 times the 1x size and is Retina 4 2x required?

I'm trying to wrap my head around everything and to make sure I do everything properly. 我正试着把头包裹在一切,并确保我做好一切。

I've been looking at The Ultimate Guide to iPhone Resolutions and want clarification on 3x and Retina 4 2x. 我一直在寻找iPhone决议的终极指南,并希望澄清3x和Retina 4 2x。

For 3x, apparently the images get downsampled. 对于3x,显然图像被下采样。 I shouldn't care about that, right? 我不应该在乎,对吧? All I need to do is put an image whose width and whose height is 3 times greater than that of the 1x image. 我需要做的就是放置一个图像,其宽度和高度是1x图像的3倍。 Of course, with the intent that I'm scaling the image. 当然,我的意图是缩放图像。 So it follows the same exact step from 1x to 2x in that I just make the size larger. 所以它遵循从1x到2x的相同精确步骤,因为我只是使尺寸更大。 Is that correct? 那是对的吗?

Then, I see the iPhone 5 and iPhone 5s which I think both use Retina 4 2x. 然后,我看到iPhone 5和iPhone 5s,我认为它们都使用Retina 4 2x。 Is Retina 4 2x required? Retina 4需要2个吗? If not, it just defaults to 2x, right? 如果没有,它只是默认为2倍,对吗? What differences should there be between the Retina 4 2x and the 2x image? Retina 4 2x和2x图像之间应该有什么区别? How would I scale the width and height differently? 我将如何以不同方式缩放宽度和高度?

You're getting a little confused. 你有点困惑。 There is just the normal, @2x and @3x. 只有正常,@ 2x和@ 3x。 There is no "retina 2x". 没有“视网膜2x”。

imageName.png 60 x 60 imageName@2x.png 120 x 120 imageName@3x.png 180 x 180

Your code will be: image = [UIImage imageNamed:@"imageName"]; 你的代码将是:image = [UIImage imageNamed:@"imageName"]; and iOS will do the rest for you. iOS将为您完成剩下的工作。 Same goes if you're using interface builder. 如果您正在使用界面构建器,则同样如此。 Just put in the standard image. 只需输入标准图像即可。

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

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