简体   繁体   English

iPhone 5中Retina图像的后缀

[英]Suffix for Retina Images in iPhone 5

我有一些适用于iPhone 5尺寸640x1136的图像文件,我以前使用@ 2x后缀为iPhone 4和4S实现了视网膜图像,那么iPhone 5中图像的后缀是什么,我们可以像@ 2x一样使用它或者它必须改变。

It'll still use @2x images where they're available. 它仍将使用@2x图像。 There's a -568h suffix you can use for the launch image, as in Default-568h@2x.png , but that's currently the only place it's supported; 您可以使用-568h后缀作为启动图像,如Default-568h@2x.png ,但这是目前唯一支持它的地方; see Leo's answer for a way to get that working elsewhere. 请参阅Leo的答案,了解如何在其他地方工作。

See my answer here . 在这里看到我的答案。 Some useful macros to help you with dealing with images. 一些有用的宏可以帮助您处理图像。

For the iPhone Retina 4-inch ( iPhone 5 ) it's still the @2x suffix because the density is the same as the iPhone Retina ( iPhone 4 and 4S ). 对于iPhone Retina 4英寸( iPhone 5 ),它仍然是@2x后缀,因为密度与iPhone Retina( iPhone 4和4S )相同。 The screen is bigger but have the same density. 屏幕较大但密度相同。

The -568h suffix will work only in for the default image because it's the only place you really need it (just to tell the system that your app have been optimized for this new screen size, and it can stretch your views). -568h后缀仅适用于默认图像,因为它是您真正需要它的唯一位置(只是告诉系统您的应用已针对此新屏幕尺寸进行了优化,并且可以拉伸您的视图)。

The naming convention Default-xxx.png is just here to provide the right image while the app is launching but I think it's non sense to try to replicate the same to load other images in imageViews. 命名约定Default-xxx.png就是在应用程序启动时提供正确的图像,但我认为尝试复制相同的图像来加载imageViews中的其他图像是没有意义的。 It's like the Default-(landscape|portrait).png on iPad. 这就像iPad上的Default-(landscape|portrait).png You never need this convention to load images yourself. 您永远不需要此约定来自己加载图像。

The only rule is: 唯一的规则是:

  • @ is for density (2 density exist right now, normal and 2x) @代表密度(现在存在2个密度,正常密度和2个密度)
  • ~ is for device (2 different devices exist right now, iphone and ipad) ~是设备(现在有2种不同的设备,iphone和ipad)

To adapt images/imageView on the 4-inch iPhone you should play with your imageView content mode and the autoresizing configurations. 要在4英寸iPhone上调整images / imageView,您应该使用imageView 内容模式自动调整配置。

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

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