ios iPhone 5 - 新图像必须遵循什么命名约定?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12431445/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 20:08:11  来源:igfitidea点击:

iPhone 5 - what naming convention the new images have to follow?

iphoneiosipadretina-display

提问by DuckDucking

What name convention the new images have to have to be loaded by the new iPhone 5?

新的 iPhone 5 必须加载新图像的命名约定是什么?

We see that we have to have 3 default images to be loaded by the device

我们看到设备必须加载 3 个默认图像

Default.png
[email protected]  and
[email protected]

what about the other images used by an app?

应用程序使用的其他图像呢?

Is there a naming convention that will automatically load the correct image?

是否有自动加载正确图像的命名约定?

采纳答案by jsd

The new default is [email protected]. (note hyphen)

新的默认值是 [email protected]。(注意连字符)

There is no other corresponding change. If you need a different image for the new iPhone 5 screen then you have to create it as a separate name. There is no 1x/2x/new phone auto switching behavior.

没有其他相应的变化。如果您需要为新的 iPhone 5 屏幕使用不同的图像,则必须将其创建为单独的名称。没有 1x/2x/新手机自动切换行为。

回答by miho

If you are looking for something similar to ~iPador ~iPhone(like ~586h) there isn't anything build in like that. But you can easily add it yourself by expanding UIImage class.

如果您正在寻找类似于~iPad~iPhone(例如~586h)的东西,则没有任何内置的东西。但是您可以通过扩展 UIImage 类轻松地自己添加它。

Have a look at this source snippet (UIImage+Retina4)for information about how to achieve. Just add this UIImage category and there will be support for ~568h@2x files.

查看此源代码片段 (UIImage+Retina4)以获取有关如何实现的信息。只需添加这个 UIImage 类别,就会支持 ~568h@2x 文件。

回答by Shimanski Artem

I solve this problem here. Just add @2x~568h suffix to images or ~568h to xib's. Also you can use this images in xib's.

在这里解决了这个问题。只需将@2x~568h 后缀添加到图像或 ~568h 到 xib 的后缀。您也可以在 xib 中使用此图像。

回答by Pranjal Bikash Das

With the introduction of Asset Catalogin Xcode 5, all you have to do with the images is simple drag and drop to its corrosponding related areas. Everything else will be handled by the Xcode itself.enter image description here.

随着Asset CatalogXcode 5的引入,您只需将图像拖放到相应的相关区域即可。其他一切都将由 Xcode 本身处理。在此处输入图片说明.

You can create new catalog by going to the above mentions option in the screenshot.

您可以通过转到屏幕截图中的上述提及选项来创建新目录。