How to Add iPhoneX Launch Image How to Add iPhoneX Launch Image ios ios

How to Add iPhoneX Launch Image

If your used the LaunchImage.launchimage for Launch, the solution is (in Xcdoe 9.0):

  1. Select Assets.xcassets, right click on middle pane, select App Icons & launch Images -> New iOS Launch Image . Then move the old LaunchImage.launchimage images to the new one, and add the image size with 1125×2436 px for the iPhoneX.enter image description hereenter image description here

  2. Also, you can add the following json object to Contents.json file which on LaunchImage.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.

  1. Open Assets.xcassets in your Xcode.
  2. Right click in your LanchImage then select Show In Finder.
  3. Open the Contents.json
  4. 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:

enter image description here

Then add your image view so it fills the entire area like this:

enter image description here

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):

enter image description here