Xcode 5 Asset Catalog 是否与 iOS 7 之前的版本向后兼容?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19031406/
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-09-15 03:55:54  来源:igfitidea点击:

Is Xcode 5 Asset Catalog backwards compatible with pre-iOS 7?

iosxcodecocoa-touch

提问by Lukas Kukacka

Xcode 5 introduced Asset Catalog, which seems very cool. However I haven't find much information about it. Specifically, I'm interested whether the usage of Asset Catalog has any impact on the app regarding its compatibility.

Xcode 5 引入了Asset Catalog,看起来很酷。但是,我还没有找到太多关于它的信息。具体来说,我感兴趣的是 Asset Catalog 的使用是否对应用程序的兼容性有任何影响。

Is Asset Catalog iOS 7 specific feature (i.e. iOS has to be able to handle it) or it is just convenience tool of Xcode?

资产目录是 iOS 7 的特定功能(即 iOS 必须能够处理它)还是只是 Xcode 的便利工具?

Also, I will be grateful for any relevant information resources / links.

此外,我将不胜感激任何相关的信息资源/链接。

Thank you for answers

谢谢你的回答

回答by Dave DeLong

Yes, it is backwards compatible.

是的,它向后兼容。

The documentation says:

文档说

Xcode 5 provides different functionality for asset catalogs depending on the deployment target for your project:

  • For all projects, individual images can be loaded using set names.
  • For projects with a deployment target of iOS 7, Xcode compiles your asset catalogs into a runtime binary file format that reduces the download time for your app.

Xcode 5 为资产目录提供不同的功能,具体取决于项目的部署目标:

  • 对于所有项目,可以使用集合名称加载单个图像。
  • 对于部署目标为 iOS 7 的项目,Xcode 将您的资产目录编译为运行时二进制文件格式,以减少应用程序的下载时间。

The new binary file format is only used if your deployment target is set to iOS 7. Otherwise it defaults back to simply putting all of the individual image files into your resources folder, as before.

仅当您的部署目标设置为 iOS 7 时才使用新的二进制文件格式。否则,它会默认返回简单地将所有单个图像文件放入您的资源文件夹中,就像以前一样。

回答by Fogmeister

Yes, it's definitely compatible with iOS6. Not sure about 5.

是的,它绝对兼容iOS6。不确定 5。

However, if you use it with earlier than 7.0 then you are not able to use the resizable images feature of asset catalogs.

但是,如果您在 7.0 之前使用它,那么您将无法使用资产目录的可调整大小的图像功能。

回答by Radu Simionescu

It is unclear if it should be backwards compatible with ios5. I can tell you for sure that it is buggy with ios 5, at least when it comes to app icons asset catalogs for iPad apps.

目前还不清楚它是否应该向后兼容 ios5。我可以肯定地告诉你,它在 ios 5 上有问题,至少在 iPad 应用程序的应用程序图标资产目录方面是这样。

If you want to use the assets catalogs to define your app icons for a ios5 compatible iPad app, the icon will appear blury or blank on the iPad (which has ios5). And that is because xcode adds a ^iPad sufix to your icon file names which iOS 5 doesn't know. So when this happens, if the app is a universal app, ios 5 will use a icon which doesn't have a ^iPad suffix (which is actually there for the iPhone version). It will pick the 57x57 version and it will be blurry when resized to 72x72.

如果您想使用资产目录为兼容 ios5 的 iPad 应用程序定义应用程序图标,则该图标将在 iPad(具有 ios5)上显示为模糊或空白。那是因为 xcode 在你的图标文件名中添加了一个 ^iPad 后缀,而 iOS 5 不知道。因此,当发生这种情况时,如果该应用程序是通用应用程序,则 ios 5 将使用没有 ^iPad 后缀的图标(实际上 iPhone 版本就有)。它将选择 57x57 版本,将其调整为 72x72 时会变得模糊。

If the app is not an universal app (it is only for iPad), ios 5 on the ipad will find no valid image (since all the icon file names have the ^iPad suffix), resulting in a blank app icon, with a gloss effect on the iPad with ios 5.

如果应用程序不是通用应用程序(仅适用于 iPad),则 ipad 上的 ios 5 将找不到有效图像(因为所有图标文件名都带有 ^iPad 后缀),从而导致应用程序图标空白,带有光泽ios 5 在 iPad 上的效果。