Launch Screen that behaves exactly like Launch Image

前端 未结 5 2051
慢半拍i
慢半拍i 2020-12-29 04:04

In order to get iPad Pro to use full resolution at launch, we have to use a Launch Screen File.

I\'ve never used a Launch Screen XIB/Storyboard before, because my ap

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-29 04:48

    This is a solution for iPad that can work,

    for iPhone you can use size classes and I am not posting that solution here.

    The solution is to break up your splash screen image into components and to use constraints to manipulate the image for Portrait vs Landscape.

    Here is an example of how I did it.

    Create a launch storyboard for iPad

    UILaunchStoryboardName~ipad (UILaunchStoryboardName~iphone )

    Take your landscape image in my case 2048x1536

    I took the landscape image and cut it into three

    1. Center 1536x1536
    2. Left 256x1536
    3. Right 256x1536

    On the launch storyboard I created 3 image views with the following constraints

    Center Piece:

    • Pin to Top and bottom,
    • center in superview,
    • maintain aspect ratio

    Left & Right Piece:

    • 0 Trailing/Leading to Center,
    • Align Top,
    • Equal Height

    Then for the Mode of the view for the left and right I changed it from aspect fill to bottom right and bottom left (worked best for me)

    I know this seems like overkill for something that should be simple. My reason for using the launch storyboard over launch images was to cut down on app size. I needed fewer launch images and I could use jpeg rather than png

提交回复
热议问题