如何在Xcode资产目录中分配启动图像? [英] How to assign launch images in Xcode assets catalog?

查看:126
本文介绍了如何在Xcode资产目录中分配启动图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xcode用于将启动图像分配到资产目录的界面相当混乱。根据我们选择的设置(仅限肖像,适用于iOS 8.0及更高版本),只有2个图像插槽可用,而

解决方案

根据您的部署目标,您需要关注3或4个总分辨率:5.5设备,4.7设备,4设备(例如iPhone SE),如果您的部署目标是iOS 9或更低版本,那么3.5设备(例如iPhone 4S)。



iOS 8.0和后来iPhone Portrait为您提供5.5和4.7设备。如果您选中iOS 7.0及更高版本iPhone肖像选项,它将为您提供2x(我认为是3.5设备)和Retina 4(这是4设备)。



使用这4个选项,您可以覆盖所有支持的iPhone。



如果您需要iPad支持,可以查看相关的iPad复选框。但是,看起来资产目录没有为iPad Pro提供插槽,我不知道为什么不。 这个答案表明对于iPad Pro你应该放弃资产目录完全转换为免费图片和Info.plist密钥。






12个图片也不需要12张图片设备。一堆设备共享相同的分辨率。以下是您需要的图片:




  • 2048x2732 - 12.9iPad Pro

  • 1668x2224 - 10.5iPad Pro

  • 1536x2048 - 9.7iPad,7.9iPad mini 4

  • 1242x2208 - iPhone 6s Plus,iPhone 7 Plus,iPhone 8 Plus

  • 750x1334 - iPhone 6,iPhone 6s,iPhone 7,iPhone 8

  • 640x1136 - iPhone 5,iPhone 5s,iPhone 5c,iPhone SE

  • 640x960 - iPhone 4s



如果您升级到Xcode 9,您还需要 1125x2436 iPhone X的图像。


Xcode's interface for assigning launch images into an assets catalog is rather confusing. Only 2 image slots are made available given the settings we've chosen (Portrait only, for iOS 8.0 and later) and yet the Apple docs list a variety of resolutions required for their various devices (6s, 6s Plus, 7, 7 Plus, etc.), 12 of them to be exact. I'm using Xcode 8.3 btw.

We are designing portrait images for commonly available devices, but how to assign them here? Notice pics below showing a confusing mismatch between the expected resolutions of images (straight from Apple docs) and the Xcode UI for assigning those images. There are only 6 slots available, and even if the Apple docs described only 6 images, it is impossible to tell which goes where.

EDIT: Deployment target is 8.3.

解决方案

Depending on your deployment target, there's either 3 or 4 total resolutions you need to care about: 5.5" devices, 4.7" devices, 4" devices (e.g. iPhone SE), and if your deployment target is iOS 9 or below then 3.5" devices (e.g. iPhone 4S).

The "iOS 8.0 and Later" iPhone Portrait gives you the 5.5" and 4.7" devices. If you check the "iOS 7.0 and Later" iPhone Portrait option that will give you "2x" (which I believe is 3.5" devices) and "Retina 4" (which is 4" devices).

Using those 4 options you'll be able to cover all supported iPhones.

If you need iPad support, you can check the relevant iPad checkbox. However, it looks like the asset catalog doesn't offer a slot for either iPad Pro, I don't know why not. This answer suggests that for the iPad Pro you should ditch the asset catalog entirely and switch to free images and Info.plist keys.


You also don't need 12 images for 12 devices. A bunch of the devices share the same resolution. Here are the images you need:

  • 2048x2732 - 12.9" iPad Pro
  • 1668x2224 - 10.5" iPad Pro
  • 1536x2048 - 9.7" iPad, 7.9" iPad mini 4
  • 1242x2208 - iPhone 6s Plus, iPhone 7 Plus, iPhone 8 Plus
  • 750x1334 - iPhone 6, iPhone 6s, iPhone 7, iPhone 8
  • 640x1136 - iPhone 5, iPhone 5s, iPhone 5c, iPhone SE
  • 640x960 - iPhone 4s

If you upgrade to Xcode 9 you'll also need an 1125x2436 image for the iPhone X.

这篇关于如何在Xcode资产目录中分配启动图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆