且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-02-03 09:52:14

更新:除非你喜欢一一调整图标大小,否则请查看

上图来自

这将为您提供一个空的应用图标集.

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

如何创建合适尺寸的图像

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

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

您可以从 1024x1024 像素的图像开始,然后将其缩小到正确的尺寸.你可以自己做,或者也有网站和脚本来获得合适的尺寸.搜索ios 应用图标生成器"或类似内容.

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

Icon-29.png//29x29 像素Icon-29@2x.png//58x58 像素Icon-29@3x.png//87x87 像素

启动图片

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

有用的文档

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

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

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

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

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

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

Icon sizes

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

How to Set the App Icon

Click Assets.xcassets in the Project navigator and then choose AppIcon.

This will give you an empty app icon set.

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.

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.

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.

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.

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
Icon-29@2x.png   // 58x58 pixels
Icon-29@3x.png   // 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 answer or the following documentation for help with this.

Useful documentation

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