简体   繁体   English

LaunchScreen无法在其他设备上使用

[英]LaunchScreen not working for different devices

Explanation 说明

I'm trying to make my LaunchScreen.storyboard work for every device, from iPhone 4 to iPad Pro. 我试图使我的LaunchScreen.storyboard在从iPhone 4到iPad Pro的所有设备上LaunchScreen.storyboard正常使用。 This way, I created 3 resolutions images: 这样,我创建了3个分辨率图像:

launchScreen@3x = 1366x1024 (iPad Pro/maximum size) launchScreen @ 3x = 1366x1024(iPad Pro /最大尺寸)
launchScreen@2x = 911x683 (1366*2/3 x 1024*2/3) launchScreen @ 2x = 911x683(1366 * 2/3 x 1024 * 2/3)
launchScreen = 455x341 (1366*1/3 x 1024*1/3) launchScreen = 455x341(1366 * 1/3 x 1024 * 1/3)

but when I add them to the project and add missing constraints, they won't work proberly, as you can see below. 但是,当我将它们添加到项目中并添加缺少的约束时,它们将无法正常工作,如下所示。

在此处输入图片说明

I know that I'm doing something wrong, but I don't know what. 我知道我做错了,但是我不知道该怎么办。 I've searched in many places, but couldn't find anything. 我在很多地方搜索过,但是找不到任何东西。 Is there anything I can do to make this work? 我有什么可以做的工作吗?


Thanks in advance, 提前致谢,
Luiz. 路易斯

First if all remove all constraint from your image view. 首先,如果全部从图像视图中删除所有约束。

After that set your imageView content mode to Scale To Fill . 之后,将imageView内容模式设置为Scale To Fill

Then give constraint to your imageView like this: 然后像这样给您的imageView约束:

在此处输入图片说明

And your result will be: 您的结果将是:

在此处输入图片说明

And here is your sample code for more info. 是您的示例代码,以获取更多信息。

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

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