简体   繁体   中英

Xcode: how to make a launchScreen storyboard

I m new in xcode, and right now i just need to build a launchScreen storyboard. but i don't know how to do this simple think :

I need to put an image at exactly 20 pixels from the bottom of the status bar (and in the launchscreen the status bar seen to be transparent i don't know if it's matter). I also need to center horizontally this image (look easy but didn't find yet how to do)

Someone can help me to do this ?

I also have 4 version of my image for different scale factor (1x, 2x, 3x and even 4x) but I don't know how (and if it's possible) to set up an image dedicated for a particular scale factor. I even don't know how to import a image in my launchScreen :(

The launch screen is available as an image asset in the Assets.xcassets folder within your project. You can link same image with multiple scaled versions(1x, 2x and 3x) referenced under a single name.

在此处输入图片说明

If not available by default, just create a new image asset with any name and specify this under the Launch Images Source tab in your targets General settings .

在此处输入图片说明

Alternatively, latest xcode versions suggest use of a launch screen storyboard. This comes under the default file name LaunchScreen.storyboard . You can create a scene here as you normally do in storyboards and specify it as the launch screen.

Hope this helps :)

The LaunchScreen is created by default when starting new projects.
You can add it in existing project too.

It's a nib where you can pub an UIImageView linked to you base image, with @2x and @3x image. You also can use the SizeClass to set customize your LaunchScreen

If your deployment target of application is less then 8.0 (ie you want to give support for ios 7 also) then you need to set launch screen two time :

1) from launchscreen.storyboard(ios 8.0 and greater) - It is simple view controller. Drag and drop imageview on it and set your image to it

2) from Assets.xcassets and new launch screen by clicking + button and the from project settings change launch image source to that launch screen file you have add in assets

So, if your deployment target is 8.0 or greater then you only need to set from launchscreen.storyboard.

Hope this will help :)

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