How would you apply a background gradient to a launch screen file?
Are you supposed to just include large image for the background or can you run code in a launch screen file to do custom drawing?
You cannot run code or use any custom classes in the Launch Screen.
You'll have to supply a stretchable image, which contains enough data for it to be viable in all resolutions.
Also, you could take advantage of the @2x
and @3x
modifiers.
iPhone 6 plus will try to load a @3x
modifier, AFAIK.
As a last resort, if the Launch Screen xib is not enough for you, you could still use the UILaunchImages plist key, and specify images for minimum version of 8.0. The downside is that Xcode does not automatically generate those for you, so you'll have to write those manually. Also remember that the modifier for iPhone 6 plus images is @3x
An example:
UILaunchImage = Default // This is for iOS 6, if you need it
UILaunchImages // iOS 7, 8
- [0]
- UILaunchImageName = Default
- UILaunchImageMinimumOSVersion = 7.0
- UILaunchImageSize = {320, 480}
- UILaunchImageOrientation = Portrait
- [1]
- UILaunchImageName = Default-568h
- UILaunchImageMinimumOSVersion = 7.0
- UILaunchImageSize = {320, 568}
- UILaunchImageOrientation = Portrait
- [2]
- UILaunchImageName = Default-667h
- UILaunchImageMinimumOSVersion = 8.0
- UILaunchImageSize = {375, 667}
- UILaunchImageOrientation = Portrait
- [3]
- UILaunchImageName = Default-736h
- UILaunchImageMinimumOSVersion = 8.0
- UILaunchImageSize = {414, 736}
- UILaunchImageOrientation = Portrait
P.S. The plist
above is also a perfect solution for those who are struggling with the localization of Image Catalogs or Launch Screen files.
As long as you can add PDF single vector assets to your projects, I usually export gradients that have to be in launch image from Illustrator or Photoshop to PDF and include them in the layout with pretty good results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With