简体   繁体   English

iOS:为所有设备启动图像,包括iPad Pro

[英]iOS: Launch Image for all devices, include iPad Pro

I followed the guidelines on making the static launch screen images. 我遵循制作静态启动屏幕图像的指导原则。

在此输入图像描述

Yet, then I added the images to the xcassets as LaunchImage 然而,然后我将图像作为LaunchImage添加到xcassets中

However, they did not fill in the asset as expected. 但是,他们没有按预期填写资产。 There are warnings warn about I need to have screen sizes such as 2208x1242, etc. Where I can have all the sizes needed for an App? 有警告警告我需要有屏幕尺寸,如2208x1242等。我可以拥有应用程序所需的所有尺寸?

在此输入图像描述

Also, why there is no iPad Pro launch images? 另外,为什么没有iPad Pro发布图像? How can I add it? 我该如何添加它? Thanks. 谢谢。

If you drag an image into the launch image asset catalog, it will warn you that it's not the right dimensions, and will tell you what the dimensions should be. 如果将图像拖动到启动图像资产目录中,它将警告您它不是正确的尺寸,并会告诉您尺寸应该是什么。 From that you can conclude: 从那以后你可以得出结论:

iPhone Portrait iOS 5,6@1x: 320x480
iPhone Portrait iOS 5,6@2x: 640x960
iPhone Portrait iOS 5,6@Retina 4: 640x1136

iPad Portrait Without Status Bar iOS 5,6@1x: 768x1004
iPad Portrait Without Status Bar iOS 5,6@2x: 1536x2008

iPad Portrait iOS 5,6@1x: 768x1024
iPad Portrait iOS 5,6@2x: 1536x2048

iPad Landscape Without Status Bar iOS 5,6@1x: 1024x748
iPad Landscape Without Status Bar iOS 5,6@2x: 2048x1496

iPad Landscape iOS 5,6@1x: 1024x768
iPad Landscape iOS 5,6@2x: 2048x1536

iPhone Portrait iOS 8,9@Retina HD 5.5: 1242x2208
iPhone Portrait iOS 8,9@Retina HD 4.7: 750x1334

iPhone Landscape iOS 8,9@Retina HD 5.5: 2208x1242

12.9-inch iPad Pro Portrait: 2048x2732
12.9-inch iPad Pro Landscape: 2732x2048

iPhone Portrait iOS 7-9@2x: 640x960
iPhone Portrait iOS 7-9@Retina 4: 640x1136

iPad Portrait iOS 7-9@1x: 768x1024
iPad Portrait iOS 7-9@2x: 1536x2048

iPad Landscape iOS 7-9@1x: 1024x768
iPad Landscape iOS 7-9@2x: 2048x1536

iPhone X Portrait iOS 11+: 1125×2436
iPhone X Landscape iOS 11+: 2436x1125

Note, it wouldn't give me the dimensions for the 12" iPad, so I got that from the iOS Human Interface Guidelines - Launch Screen which you included in your question. 请注意,它不会给我12“iPad的尺寸,所以我从你的问题中包含的iOS人机界面指南 - 启动屏幕中得到了它。

Updated image with asset dimensions annotated : 已注释资产维度的更新图像:

LaunchImage资产维度

To anyone reading this and is giving up hope on adding old style Launch Images for iPad Pro 10.5 inch, 11 inch and 12.9 inch , you can add them without using the Storyboard or Launch Screen thing in XCode. 对于阅读此内容且放弃希望为iPad Pro 10.5英寸,11英寸和12.9英寸添加旧式启动图像的人,您可以在使用XCode中的Storyboard或Launch Screen的情况下添加它们。

The way we did it was by editing the .plist of our app: 我们这样做的方式是编辑我们的应用程序的.plist:

<key>UILaunchImages</key>
<array>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>7.0</string>
        <key>UILaunchImageName</key>
        <string>Default-Portrait</string> //iPad Pro 10.5"
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{768, 1024}</string>
    </dict>
    <dict> 
        <key>UILaunchImageMinimumOSVersion</key>
        <string>12.0</string>
        <key>UILaunchImageName</key>
        <string>Default-Portrait-1194h</string> //iPad Pro 11"
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{834, 1194}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>9.0</string>
        <key>UILaunchImageName</key>
        <string>Default-Portrait-iPadPro</string>//iPad Pro 12"
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{1024, 1366}</string>
    </dict>
</array>

(Be sure to remove the //iPad Pro comments obviously!) (请务必明白删除// iPad Pro评论!)

And here are the filenames: 这是文件名:

iPad Pro 10.5": Default-Portrait@2x~ipad iPad Pro 10.5“:默认 - 肖像@ 2x~ipad

iPad Pro 11": Default-Portrait-1194h@2x.png iPad Pro 11“: Default-Portrait-1194h@2x.png

iPad Pro 12": Default-Portrait-iPadPro@2x~ipad iPad Pro 12“:默认 - 肖像 - iPadPro @ 2x~ipad

Tested on all 3 of those devices and it works. 测试了所有这三个设备,它的工作原理。

Hope this helps someone! 希望这有助于某人!

In Assets.xcassets click + button -> App Icons & Launch Images -> New iOS Launch Image 在Assets.xcassets中单击+按钮 - >应用程序图标和启动图像 - >新的iOS启动图像

在此输入图像描述

Launch Screens should probably be taken care of by Storyboards rather than static images. 启动屏幕应该由故事板而不是静态图像来处理。 However the Launch Screens aren't included in your Main.storyboard file. 但是,启动屏幕不包含在Main.storyboard文件中。 That way, Xcode will resize everything as expected with Auto Layout and you don't have to fill your app with tons of image files. 这样,Xcode将按照预期使用自动布局调整所有内容的大小,并且您不必用大量图像文件填充您的应用程序。 So it'll work with the iPad Pro sizes 9.7" 2048 x 1536px and 12.9", 2732 x 2048px . 所以它适用于iPad Pro尺寸9.7“ 2048 x 1536px和12.9”, 2732 x 2048px

In Xcode, go to File > New File > Launch Screen (Under the User Interface header) > then all the usual location and target adding bits. 在Xcode中,转到文件 > 新文件 > 启动屏幕 (在用户界面标题下)>然后是所有常用位置和目标添加位。

Creating a new Launch Image file 创建新的启动映像文件

Edit it like you would in Interface Builder. 像在Interface Builder中一样编辑它。 As far as I'm aware, you can't assign a Class to it so don't expect any animations. 据我所知,你不能为它分配一个类,所以不要指望任何动画。

Xcode showing the Launch Screen in Interface Builder Xcode显示Interface Builder中的启动屏幕

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM