简体   繁体   English

启动屏幕故事板

[英]Launch Screen Storyboard

As LaunchScreen I want to have an exact image of the start page that appears right after the launch. 作为LaunchScreen,我想要在启动后立即显示起始页面的精确图像。 Therefore, I made screenshots of all resolutions of the start page, both portrait and landscape. 因此,我制作了起始页面的所有分辨率的截图,包括纵向和横向。 Then I removed all fonts because I generate two variants of the app in different languages and the texts (eg in the buttons) are different. 然后我删除了所有字体,因为我生成了两种不同语言的应用程序变体,而文本(例如按钮)则不同。 The launch screens should fit both variants. 启动屏幕应该适合两种变体。 In Images.xcassets I added LaunchImage and assigned all positions with the correct resolutions (for both, iPhone and iPad). 在Images.xcassets中,我添加了LaunchImage,并为所有位置分配了正确的分辨率(适用于iPhone和iPad)。 LaunchScreen.storyboard has an ImageView in the ViewController with the image name LaunchImage. LaunchScreen.storyboard在ViewController中有一个ImageView,其图像名称为LaunchImage。

Result: 结果:

1 All launch images displayed are scaled even though the correct resolutions are available. 1即使有正确的分辨率,所有显示的启动图像也会缩放。

  1. Only the portrait images are used, also for landscape, and therefore scaled and distorted. 仅使用肖像图像,也用于横向图像,因此缩放和扭曲。

  2. on iPads only iPhone images are displayed, portrait version also in landscape, scaled accordingly. 在iPad上只显示iPhone图像,纵向版本也在横向显示,相应缩放。

  3. On some devices (eg iPhone X), only a white or black screen is displayed at launch (portrait and landscape). 在某些设备(例如iPhone X)上,启动时仅显示白色或黑色屏幕(纵向和横向)。

Under no circumstances will the correct launch screen be displayed. 在任何情况下都不会显示正确的启动屏幕。 On the image you see all relevant areas and the list of all used launch images. 在图像上,您可以看到所有相关区域以及所有已使用的启动图像列表。

What did I do wrong or miss? 我做错了什么或错过了什么?

在此输入图像描述 Supplement: I just followed another tip and deactivated "Clears Graphic Context" in UIImageView and changed the display to "Aspect Fit". 补充:我只是按照另一个提示并在UIImageView中取消激活“清除图形上下文”并将显示更改为“Aspect Fit”。 Result: The portrait launch image is still used in the iPad, but is no longer scaled and is now centered. 结果:纵向启动图像仍在iPad中使用,但不再缩放,现在居中。 So the most important question now is why an iPhone portrait launch image is used for iPad in both directions. 因此,现在最重要的问题是为什么iPhone纵向启动图像可以在两个方向上用于iPad。

If you are using a LaunchImage , you should set that image in the Target settings. 如果您使用的是LaunchImage ,则应在目标设置中设置该图像。 Go to your target and under the General tab, set the Launch Images Source value to the image you have in your asset catalog: 转到目标并在“ General选项卡下,将“ Launch Images Source值设置为资产目录中的图像:

在此输入图像描述

Also delete the text LaunchScreen in the Launch Screen File field. 同时删除“ Launch Screen File字段中的文本“ LaunchScreen ”。

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

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