问题
I am testing image launch-screens on the iPhone X and ran into a strange behavior. So I'd like to request some feedback before opening a radar:
I created a portrait and landscape launch-screen with the dimensions 1125 x 2436 Pixel
(portrait) and 2436 x 1125 Pixel
(landscape). Then I add them to the asset catalog and they are picked up correctly:
So far so good. Then I run the app on the iPhone X Simulator (I've reset the app before to ensure nothing is cached) and the (stretched) landscape-image is shown.
I validated the png sources to have a valid non-alpha background and am still unable to show the correct launch-screen. I noticed that the portrait image is not even copied to the resulting product:
So that might suggest an issue with Xcode 9. Any feedback is more than welcome, thanks guys!
EDIT: Side-note: When removing the landscape image from the asset-catalog, the portrait one is copied and picked up correctly.
UPDATE 09/29/2017: Apple confirmed that it is indeed an issue in Xcode and it will be given to the related engineering-team.
回答1:
For the iPhone X, try using a launch screen storyboard instead of launch images.
This is mentioned in the new "Building Apps for iPhone X" video on Apple's developer site: https://developer.apple.com/videos/play/fall2017/201/
(It's mentioned at the 2:50 mark.)
To set a launch screen storyboard, create a storyboard file and choose it from the "Launch Screen File" dropdown in your project settings.
回答2:
This is finally fixed in Xcode 9.1 Beta 2 and above!
回答3:
Using only the portrait image (and no landscape one) seems to work, at least on the simulator. Anyhow, iPhone X can launch apps only from portrait. Don't know if this solution will create issues on the actual device (iPhone X isn't available yet at time of this writing). I would guess it doesn't.
回答4:
This is clearly an xCode 9 bug, i've the same problem, also the filename of the asset is not correct, following previous naming convention there must be 2 files, LaunchImage-1100-Portrait-2436h@3x.png and LaunchImage-1100-Landscape-2436h@3x.png (note why 2436h and not 812h, all the others resolution are expressed in point not pixel)
来源:https://stackoverflow.com/questions/46263795/iphone-x-incorrect-launch-screen-orientation-used