简体   繁体   中英

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. This way, I created 3 resolutions images:

launchScreen@3x = 1366x1024 (iPad Pro/maximum size)
launchScreen@2x = 911x683 (1366*2/3 x 1024*2/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 .

Then give constraint to your imageView like this:

在此处输入图片说明

And your result will be:

在此处输入图片说明

And here is your sample code for more info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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