Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 8 - Background gradient for launch screen file

Tags:

xcode6

ios8

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?

like image 324
Berry Blue Avatar asked Sep 10 '14 18:09

Berry Blue


2 Answers

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.

like image 198
daniel.gindi Avatar answered Nov 14 '22 23:11

daniel.gindi


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.

like image 37
txuslee Avatar answered Nov 14 '22 22:11

txuslee