How to Add iPhoneX Launch Image
If your used the LaunchImage.launchimage
for Launch, the solution is (in Xcdoe 9.0):
Select
Assets.xcassets
, right click on middle pane, selectApp Icons & launch Images
->New iOS Launch Image
. Then move the oldLaunchImage.launchimage
images to the new one, and add the image size with1125×2436 px
for the iPhoneX.Also, you can add the following json object to
Contents.json
file which onLaunchImage.launchimage
folder in your old project。Once Xcode refreshes, just drop in a 1125×2436px image. If you need landscape, you can add another with the orientation.
{ "extent" : "full-screen", "idiom" : "iphone", "subtype" : "2436h", "minimum-system-version" : "11.0", "orientation" : "portrait", "scale" : "3x" }
To the 2018 lazy devs like me who has an existing project that has an old version of launchimage (with no iPhoneX variant), here's my solution to support iPhone X - this is a shortcut one for you.
- Open Assets.xcassets in your Xcode.
- Right click in your LanchImage then select Show In Finder.
- Open the Contents.json
- Paste the follow codes inside your "images" array.
{ "extent" : "full-screen", "idiom" : "iphone", "subtype" : "2436h", "filename" : "ipxportrait.png", "minimum-system-version" : "11.0", "orientation" : "portrait", "scale" : "3x"},{ "extent" : "full-screen", "idiom" : "iphone", "subtype" : "2436h", "filename" : "ipxlandscape.png", "minimum-system-version" : "11.0", "orientation" : "landscape", "scale" : "3x"},
Replace of course the filename with appropriate images. Voila!
If I understood correctly, you are using a storyboard as a Launch Screen with image view, right?
If so, in you Launch Screen storyboard select to view as iPhone X:
Then add your image view so it fills the entire area like this:
and pin it to the superview with constants of 0. It's important to do this with iPhone X selected, because otherwise you would probably pin to Top Layout Guide, which you don't want to, because it will leave you with a gap at the top.
Your constaints should look like this (pinned to Superview):