iOS 如何设置应用程序图标和启动图像

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

iOS how to set app icon and launch images

iosxcodeiconsarchivelaunchimage

提问by user3925803

How do I set the images so that I can archive and validate my app? The screen looks like this now:

如何设置图像以便我可以存档和验证我的应用程序?屏幕现在看起来像这样:

enter image description here

在此处输入图片说明

So the first one says 29pt, but then it also says 2x. So do I put a 29x29image or a 58x58image? And where do I put all of the other ones? (I know that there are more sizes than 29, 40, and 60).

所以第一个说29pt,但它也说2x。那么我是放29x29图片还是58x58图片呢?我把所有其他的放在哪里?(我知道有更多的大小比294060)。

Anyway, what I tried was I dragged a 29x29png onto the first slot, a 40x40onto the second, and a 60x60onto the third and fourth. When I went to Product->Archive, I get

无论如何,我尝试的是将一个29x29png 拖到第一个插槽上,将 a40x40拖到第二个插槽上,将 a60x60拖到第三个和第四个插槽上。当我去的时候Product->Archive,我得到

/Users/kendon/Documents/iPhone Apps/Sales Tool/Sales Tool/Images.xcassets: The app icon set named "AppIcon" did not have any applicable content.

/Users/kendon/Documents/iPhone Apps/Sales Tool/Sales Tool/Images.xcassets:名为“AppIcon”的应用图标集没有任何适用的内容。

回答by Suragch

Update:Unless you love resizing icons one by one, check out Schmoudi's answer. It's just a lot easier.

更新:除非您喜欢一一调整图标大小,否则请查看Schmoudi 的回答。这简单多了。

Icon sizes

图标大小

enter image description here

在此处输入图片说明

Above image from Designing for iOS 9. They are the same for iOS 10.

上图来自Designing for iOS 9。它们对于 iOS 10相同的

How to Set the App Icon

如何设置应用程序图标

Click Assets.xcassetsin the Project navigator and then choose AppIcon.

单击Project 导航中的Assets.xcassets,然后选择AppIcon

enter image description here

在此处输入图片说明

This will give you an empty app icon set.

这将为您提供一个空的应用程序图标集。

enter image description here

在此处输入图片说明

Now just drag the right sized image (in .png format) from Finder onto every blank in the app set. The app icon should be all set up now.

现在只需将合适大小的图像(.png 格式)从 Finder 拖到应用程序集中的每个空白处。应用程序图标现在应该已经全部设置好了。

How to create the right sized images

如何创建合适尺寸的图像

The image at the very top tells the pixels sizes for for each point size that is required in iOS 9. However, even if I don't get this answer updated for future versions of iOS, you can still figure out the correct pixel sizes using the method below.

最顶部的图像告诉了 iOS 9 中所需的每个点大小的像素大小。但是,即使我没有为未来版本的 iOS 更新此答案,您仍然可以使用以下方法找出正确的像素大小下面的方法。

Look at how many points (pt) each blank on the empty image set is. If the image is 1x then the pixels are the same as the points. For 2x double the points and 3x triple the points. So, for example, in the first blank above (29pt 2x) you would need a 58x58 pixel image.

看看空图像集上的每个空白是多少点(pt)。如果图像是 1x,则像素与点相同。对于 2 倍的积分和 3 倍的积分。因此,例如,在上面的第一个空白 (29pt 2x) 中,您需要一个 58x58 像素的图像。

You can start with a 1024x1024 pixel image and then downsize it to the correct sizes. You can do it yourself or there are also websites and scripts for getting the right sizes. Do a search for "ios app icon generator" or something similar.

您可以从 1024x1024 像素的图像开始,然后将其缩小到正确的尺寸。你可以自己做,或者也有网站和脚本来获得合适的尺寸。搜索“ios app icon generator”或类似的东西。

I don't think the names matter as long as you get the dimensions right, but the general naming convention is as follows:

只要尺寸正确,我认为名称并不重要,但一般命名约定如下:

Icon-29.png      // 29x29 pixels
[email protected]   // 58x58 pixels
[email protected]   // 87x87 pixels

Launch Image

启动图像

Although you can use an image for the launch screen, consider using a launch screen storyboard file. This will conveniently resize for every size and orientation. Check out this SO answeror the following documentation for help with this.

尽管您可以将图像用于启动屏幕,但请考虑使用启动屏幕故事板文件。这将方便地为每个尺寸和方向调整大小。查看此 SO 答案或以下文档以获取帮助。

Useful documentation

有用的文档

The Xcode images in this post were created with Xcode 7.

这篇文章中的 Xcode 图像是使用 Xcode 7 创建的。

回答by Schmoudi

I recently found this App called Icon Set Creatorin the App Storewhich is free, without ads, updated on new changes, straight forward and works just fine for every possible icon size in OSX, iOS and WatchOS:

我最近在App Store 中发现了这个名为Icon Set Creator应用程序,它是免费的,没有广告,更新了新的变化,直接适用于 OSX、iOS 和 WatchOS 中所有可能的图标大小:

In Icon Set Creator:

在图标集创建器中:

  1. Drag your image into the view
  2. Choose your target platform
  3. Export the Icon Set folder
  1. 将您的图像拖到视图中
  2. 选择您的目标平台
  3. 导出图标集文件夹

iconSetCreator

图标集创建器

In XCode:

在 XCode 中:

  1. Navigate to the Assets.xcassetsFolder
  2. Delete the pre existing AppIcon
  3. Right click -> Importyour created Icon-Set as AppIconand you're done
  1. 导航到Assets.xcassets文件夹
  2. 删除现有的 AppIcon
  3. 右键单击 ->将您创建的 Icon-Set导入AppIcon,您就完成了

回答by K.S.

To save a bit time:

为了节省一点时间:

1) You can mark your app icon images all in finder and drag them into your Assets catalog all at once by dragging into one of the empty slots of the app icon imageset. When you hold your drag over the slot, several of the other slots look selected and when you drop those all will be filled up at once. Note that this works in XCode 8 (I haven't tried XCode 7), but in XCode 9 beta not yet.

1) 您可以在 finder 中标记您的应用程序图标图像,并通过将它们拖入应用程序图标图像集的空槽之一来一次性将它们拖入您的资产目录。当您在插槽上拖动鼠标时,其他几个插槽看起来已被选中,而当您放下这些插槽时,它们将立即被填满。请注意,这适用于 XCode 8(我还没有尝试过 XCode 7),但在 XCode 9 beta 中还没有。

Dragging into app icon Asset catalog imageset

拖入应用程序图标资产目录图像集

2) The "Technical Q&A QA1686"apple documentation site has the sizes per app icon slot already calculated for you in a nice image and also contains the correct image names conventions.

2)“技术问答 QA1686”苹果文档站点已经为您计算了每个应用程序图标插槽的大小,并以漂亮的图像显示,并且还包含正确的图像名称约定。

App icon sizes

应用程序图标大小

回答by bzz

The correct sizes are as following:

正确的尺寸如下:

1)58x58

1)58x58

2)80x80

2)80x80

3)120x120

3)120x120

4)180x180

4)180x180

回答by Craig.Pearce

I use a tool called Prepo to produce all the right image sizes. You simply feed the app you image file and it will spit out each necessary file with an appropriate name.

我使用名为 Prepo 的工具来生成所有正确的图像尺寸。您只需将图像文件提供给应用程序,它就会以适当的名称吐出每个必要的文件。

Once you do this, you can then drag in the appropriate files or simply point to your Prepo exported folder.

完成此操作后,您可以拖入适当的文件或简单地指向您的 Prepo 导出文件夹。

回答by ViralRathod

Now a days is really easy to set app-icon, just go to https://makeappicon.com/add your image, they will send you all size of App-icon (Also for watch & itunes as well), now Click Assets.xcassets in the Project navigator and then choose AppIcon. Now you just have to drag n drop the icon as required.

现在设置应用程序图标真的很容易,只需转到 https://makeappicon.com/添加您的图像,他们就会向您发送所有大小的应用程序图标(也适用于手表和 iTunes),现在单击资产.xcassets 在项目导航器中,然后选择 AppIcon。现在您只需要根据需要拖放图标即可。

回答by Gunjit

In the left list, right click on "AppIcon" and click on "Open in finder" A folder with name "AppIcon.appiconset" will open. Paste all the graphics with required resolution there. Once done, all those images will be visible in this same screen(one in your screen shot). then drag them to appropriate box. App icons have been added. Same process for Launch images. Launch images through this process are added for iOS 7 and below. For iOS 8 separate LaunchScreen.xib file is made by default.

在左侧列表中,右键单击“AppIcon”并单击“在查找器中打开”将打开一个名为“AppIcon.appiconset”的文件夹。将所有具有所需分辨率的图形粘贴到那里。完成后,所有这些图像都将在同一个屏幕中可见(屏幕截图中的一个)。然后将它们拖到适当的框中。添加了应用程序图标。启动图像的过程相同。为 iOS 7 及更低版本添加了通过此过程启动的图像。对于 iOS 8,默认情况下会生成单独的 LaunchScreen.xib 文件。

回答by Vladyslav Panchenko

I found App called Iconizer. You can find repository on github. Iconizer can generate app icons for OS X, iPad, iPhone, CarPlayand Apple Watchwith just one image.

我找到了名为 Iconizer 的应用程序。您可以在github上找到存储库。Iconizer只需一张图像即可为OS X、iPad、iPhone、CarPlayApple Watch生成应用程序图标。

Simply Drag and Drop your icon onto Iconizer, select the platforms you need and whether or not you want all platforms generated into one asset catalog, then hit export.

只需将您的图标拖放到 Iconizer 上,选择您需要的平台以及您是否希望将所有平台生成到一个资产目录中,然后点击导出。

After that just replace (delete and import) your AppIcon in the Assets.xcassets

之后,只需在 Assets.xcassets 中替换(删除和导入)您的AppIcon

回答by Ant

This is a very frustrating part of XCode. Like many, I wasted hours on this when I switched to a newer version of xcode (version 8). The solution for me was to open the properties for my project and under the "App Icons and Launch Images" choose the "migrate" option for the icons. This made absolutely no sense to me as I already had all my icons there, but it worked! Unfortunately I now seem to have two copies of my launcher icons in the project though.

这是 XCode 非常令人沮丧的部分。像许多人一样,当我切换到较新版本的 xcode(版本 8)时,我浪费了几个小时。我的解决方案是打开我的项目的属性,然后在“应用程序图标和启动图像”下为图标选择“迁移”选项。这对我来说完全没有意义,因为我已经有了我所有的图标,但它起作用了!不幸的是,我现在似乎在项目中有两个我的启动器图标副本。

回答by Raj Aryan

As per updated version(Xcode 8.3.3) I saw that below resolution are required for all fields of AppIconsets.

根据更新版本(Xcode 8.3.3),我看到AppIcon集合的所有字段都需要以下分辨率。

40x40
58x58
60x60
80x80
87x87
120x120
180x180

It comes with hdpi, xhdpi, xxhdpi etc. Hope it will helps others.

它带有 hdpi、xhdpi、xxhdpi 等。希望它能帮助其他人。

Edited to 120x120

编辑为 120x120