iOS 7 应用程序图标、启动图像和命名约定,同时保留 iOS 6 图标

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

iOS 7 App Icons, Launch images And Naming Convention While Keeping iOS 6 Icons

iosxcodeios7xcode5

提问by AJ112

I just finished an app on iOS 6 and bought a developer account a week ago so haven't had much time playing with the iOS 7 SDK. Just downloaded the Golden Master version and trying to upgrade my app to be compatible with iOS 7.

我刚刚在 iOS 6 上完成了一个应用程序,并在一周前购买了一个开发者帐户,所以没有太多时间玩 iOS 7 SDK。刚刚下载了 Golden Master 版本并尝试升级我的应用程序以与 iOS 7 兼容。

I realised that iOS 7 requires a little work with app icons. I have checked many related question and i am confused what to do. I already have an iOS 6 app with app icons and when i installed the golden master version i saw the following:

我意识到 iOS 7 需要对应用程序图标进行一些处理。我已经检查了许多相关的问题,但我很困惑该怎么做。我已经有一个带有应用程序图标的 iOS 6 应用程序,当我安装黄金大师版本时,我看到了以下内容:

iOS 7 App Icons

iOS 7 应用程序图标

and for launch images:

和启动图像:

iOS 7 Launch Images

iOS 7 启动图像

I can create new flat icons for iOS 7 while i want iOS users to keep seeing the old ones.

我可以为 iOS 7 创建新的平面图标,同时我希望 iOS 用户继续看到旧的。

What should i do? Use the "Use Asset Catalog" or add the icons manually and if i am adding the icons manually then what should i name these images? Thanks!

我该怎么办?使用“使用资产目录”或手动添加图标,如果我手动添加图标,那么我应该为这些图像命名什么?谢谢!

采纳答案by Tarek Hallak

Absolutely Asset Catalogis you answer, it removes the need to follow naming conventions when you are adding or updating your app icons.

绝对资产目录是您的答案,它消除了在您添加或更新应用程序图标时遵循命名约定的需要。

Below are the steps to Migrating an App Icon Set or Launch Image SetFrom Apple:

以下是从Apple迁移应用程序图标集或启动图像集的步骤:

1- In the project navigator, select your target.

1- 在项目导航器中,选择您的目标。

2- Select the General pane, and scroll to the App Icons section.

2- 选择常规窗格,然后滚动到应用程序图标部分。

enter image description here

在此处输入图片说明

3- Specify an image in the App Icon table by clicking the folder icon on the right side of the image row and selecting the image file in the dialog that appears.

3- 通过单击图像行右侧的文件夹图标并在出现的对话框中选择图像文件,在应用程序图标表中指定图像。

enter image description here

在此处输入图片说明

4-Migrate the images in the App Icon table to an asset catalog by clicking the Use Asset Catalog button, selecting an asset catalog from the popup menu, and clicking the Migrate button.

4-通过单击使用资产目录按钮,从弹出菜单中选择资产目录,然后单击迁移按钮,将应用图标表中的图像迁移到资产目录。

enter image description here

在此处输入图片说明

Alternatively, you can create an empty app icon set by choosing Editor > New App Icon, and add images to the set by dragging them from the Finder or by choosing Editor > Import.

或者,您可以通过选择“编辑器”>“新建应用程序图标”来创建一个空的应用程序图标集,然后通过从 Finder 中拖动图像或选择“编辑器”>“导入”来将图像添加到该集中。

回答by msmq

You should use Asset Catalog:

您应该使用资产目录:

I have investigated, how we can use Asset Catalog; Now it seems to be easy for me. I want to show you steps to add icons and splash in asset catalog.

我已经调查过,我们如何使用资产目录;现在对我来说似乎很容易。我想向您展示在资产目录中添加图标和飞溅的步骤。

Note:No need to make any entry in info.plist file :) And no any other configuration.

注意:无需在 info.plist 文件中进行任何输入 :) 并且无需任何其他配置。

In below image, at right side, you will see highlighted area, where you can mention which icons you need. In case of mine, i have selected first four checkboxes; As its for my app requirements. You can select choices according to your requirements.

在下图中,在右侧,您将看到突出显示的区域,您可以在其中提及您需要哪些图标。在我的情况下,我选择了前四个复选框;至于我的应用程序要求。您可以根据自己的要求进行选择。

enter image description here

在此处输入图片说明

Now, see below image. As you will select any App icon then you will see its detail at right side selected area. It will help you to upload correct resolution icon. enter image description here

现在,请看下图。当您选择任何应用程序图标时,您将在右侧所选区域看到其详细信息。它将帮助您上传正确的分辨率图标。 在此处输入图片说明

If Correct resolution image will not be added then following warning will come. Just upload the image with correct resolution. enter image description here

如果不添加正确分辨率的图像,则会出现以下警告。只需上传具有正确分辨率的图像。 在此处输入图片说明

After uploading all required dimensions, you shouldn't get any warning. enter image description here

上传所有必需的维度后,您不应收到任何警告。 在此处输入图片说明

回答by ohho

In case you do notwant to use Asset Catalog, you can add an iOS 7 icon for an old app by creating a 120x120 .png image. Name it Icon-120.pngand drag in to the project.

如果你希望使用资产类别,你可以通过创建一个120×120的PNG图片添加的iOS 7的图标为一个旧的应用程序。命名Icon-120.png并拖入项目。

Under TARGET > Your App > Info > Icon files, add one more entry in the Target Properties:

在 TARGET > Your App > Info > Icon files 下,在 Target Properties 中再添加一项:

enter image description here

在此处输入图片说明

I tested on Xcode 5 and an app was submitted without the missing retina icon warning.

我在 Xcode 5 上进行了测试,提交的应用程序没有缺少视网膜图标警告。

回答by Danoli3

Okay adding to @null's awesome post about using the Asset Catalog.

好的,添加到@null 关于使用Asset Catalog的精彩帖子中。

You may need to do the following to get the App's Icon linked and working for Ad-Hoc distributions/ productionto be seen in Organiser, Test flightand possibly unknown AppStore locations.

您可能需要执行以下操作以链接应用程序的图标并为Ad-Hoc 分发/生产工作,以便在OrganizerTest flight和可能未知的 AppStore 位置中看到。



After creating the Asset Catalog, take note of the name of the Launch Images and App Icon names listed in the .xassetsin Xcode.

创建 Asset Catalog 后,记下.xassetsXcode 中列出的 Launch Images 名称和 App Icon 名称。

By Default this should be

默认情况下,这应该是

  • AppIcon
  • LaunchImage
  • AppIcon
  • LaunchImage

[To see this click on your .xassets folder/icon in Xcode.] (this can be changed, so just take note of this variable for later)

[要查看此内容,请单击 Xcode 中的 .xassets 文件夹/图标。](这可以更改,因此请注意此变量以备后用)



What is created now each build is the following data structures in your .app:

现在每次构建创建的是 .app 中的以下数据结构:

For App Icons:

对于应用程序图标:

iPhone

苹果手机

  • AppIcon57x57.png(iPhone non retina) [Notice the Icon name prefix]
  • [email protected](iPhone retina)
  • AppIcon57x57.png(iPhone 非视网膜) [注意图标名称前缀]
  • [email protected](iPhone 视网膜)

And the same format for each of the other icon resolutions.

其他每个图标分辨率的格式都相同。

iPad

iPad

  • AppIcon72x72~ipad.png(iPad non retina)
  • AppIcon72x72@2x~ipad.png(iPad retina)
  • AppIcon72x72~ipad.png(iPad 非视网膜)
  • AppIcon72x72@2x~ipad.png(iPad 视网膜)

(For iPad it is slightly different postfix)

(对于 iPad,后缀略有不同)



Main Problem

主要问题

Now I noticed that in my Info.plistin Xcode 5.0.1 it automatically attempted and failed to create a key for "Icon files (iOS 5)" after completing the creation of the Asset Catalog.

现在我注意到,在我Info.plist的 Xcode 5.0.1 中,它Icon files (iOS 5)在完成资产目录的创建后自动尝试并未能为“ ”创建密钥。

If it did create a reference successfully / this may have been patched by Apple or just worked, then all you have to do is review the image names to validate the format listed above.

如果它确实成功创建了一个参考/这可能已被 Apple 修补或刚刚工作,那么您所要做的就是查看图像名称以验证上面列出的格式。

Final Solution:

最终解决方案:

Add the following key to you main .plist

将以下键添加到您的 main .plist

I suggest you open your main .plistwith a external text editor such as TextWrangler rather than in Xcode to copy and paste the following key in.

我建议您.plist使用外部文本编辑器(例如 TextWrangler)而不是在 Xcode 中打开主文件以复制并粘贴以下键。

<key>CFBundleIcons</key>
<dict>
    <key>CFBundlePrimaryIcon</key>
    <dict>
        <key>CFBundleIconFiles</key>
        <array>
            <string>AppIcon57x57.png</string>
            <string>[email protected]</string>
            <string>AppIcon72x72~ipad.png</string>
            <string>AppIcon72x72@2x~ipad.png</string>
        </array>
    </dict>
</dict>

Please Note I have only included my example resolutions, you will need to add them all.

请注意,我只包含了我的示例分辨率,您需要将它们全部添加。



If you want to add this Key in Xcode without an external editor, Use the following:

如果要在没有外部编辑器的情况下在 Xcode 中添加此 Key,请使用以下命令:

  • Icon files (iOS 5)- Dictionary
  • Primary Icon- Dictionary
  • Icon files- Array
  • Item 0- String = AppIcon57x57.pngAnd for each other item / app icon.
  • Icon files (iOS 5)- 字典
  • Primary Icon- 字典
  • Icon files- 大批
  • Item 0- String =AppIcon57x57.png并且对于每个其他项目/应用程序图标。


Now when you finally archive your project the final .xcarchive payload .plist will now include the above stated icon locations to build and use.

现在,当您最终归档项目时,最终的 .xcarchive 有效负载 .plist 现在将包含上述要构建和使用的图标位置。

Do not add the following to any .plist: Just an example of what Xcode will now generate for your final payload

不要将以下内容添加到任何 .plist:只是 Xcode 现在将为您的最终有效负载生成的示例

<key>IconPaths</key>
<array>
    <string>Applications/Example.app/AppIcon57x57.png</string>
    <string>Applications/Example.app/[email protected]</string>
    <string>Applications/Example.app/AppIcon72x72~ipad.png</string>
    <string>Applications/Example.app/AppIcon72x72@2x~ipad.png</string>
</array>