LaunchScreen.storyboard different screen ratios

I need help getting a very basic LaunchScreen.storyboard working. My launch screen is just an image. I need the storyboard to handle the image by letterboxing it if the device ratio is not 4::3 (iPad).


I have a Univeral app (iPad/iPhone) created with xcode 8 with iOS 10.3 as deployment target. I used xcode's app template for this new Swift 3 SpriteKit project. Its a simple SpriteKit app. The app is viewed on iPad and iPhone in 4::3 ratio, landscape only. aspectFit is properly respected in my SpriteKit views on all devices. So on iPhone its letterboxed, which looks and works great for my needs.


The app is well tested on multiple devices and today tested through xcode 9 builds on iOS 11.

All good! I should be ready to publish...but...one more thing! The LaunchScreen.

I'm dealing with LaunchScreen.storyboard madness. All I want is my launch image (same size as my other SpriteKit background images) to display in letterbox form, for non 4::3 devices, to fit the screen. aspectFit certainly doesn't work the same in the view settings in storyboard as it does in SpriteKit.


I feel like I've done 100 Google queries, read as many blog posts and forums and tried a couple hundred different things in xcode and am getting nowhere.


Any help appreciated.

thanks

Replies

How did you set the Content Mode ? Aspect fit ?


Can you explain how exactly you would want the image to display when you say "fit the screen" and what you get presently ?

Did you ever solve this?


I'm facing a similar madness now. I have LaunchImage in the Images.xcassets catalog, and they all have correct-dimension images assigned. Xcode 10, iOS 12.


I have Launch Screen.storyboard, with a single imageview sized to the screen, referencing "LaunchImage" as the image to display.


Works fine on Simulator, but on devices it doesn't show (oddly, white background on an iPhone 6S, black background on an iPhone X).


It complains that it can't find the image

Could not load the "LaunchImage" image referenced from a nib in the bundle with identifier


In which case, how can I possibly get it to load the correct image for a given device...


An approach that might work:

- Add all the images with different names to the root of the project

- Set the Launch storyboard to use Trait variations

- Vary the name in every single trait


But if that is the case, how is that ANY improvement on how things were managed back in say Xcode 3?


(I'll be forced to try it but maybe someone will spot my whining and share a better way)

(The app design has a rich image launch screen whereby scaling irregularities will be very obvious)


Thanks in advance for anyone who has better ideas 🙂

Is your image a .png ?


Did you insert the image in the Assets.xcassets ?

The image is in Assets yes, it is the LaunchScreen type with all of the portrait images filled with correctly-sized PNGs.


The background consists of the corporate background colours and logo, so it can't be stretched on demand it needs designing per spect ratio.


I still don't actually have a clean solution to this, it seems very odd that Xcode doesn't want to let us reference LaunchImage in other storyboards too, and odd that it doesn't work in the Launch storyboard.


But this scenario must be very common, given all of the various launch screens on apps that are adjusted for the screen size.