14

Is there any way to set linear gradient to background of LaunchScreen.xib in iOS? Something like background="linear-gradient(#000000, #123456)"?

<view contentMode="scaleToFill" background="...">
    <rect key="frame" width="753" height="867"/>
</view>
Vesmy
  • 1,190
  • 4
  • 15
  • 29
  • Possible duplicate of [iOS 8 - Background gradient for launch screen file](https://stackoverflow.com/questions/25772862/ios-8-background-gradient-for-launch-screen-file) – rptwsthi Apr 12 '19 at 12:15

2 Answers2

19

You can create a vector image (pdf) with a gradient, add an ImageView to launchscreen and set that vector as the image.

If the image doesn't show up, clear the Xcode cache, restart Xcode, delete the app from your device, restart the device, and then it should show up.

lenooh
  • 10,364
  • 5
  • 58
  • 49
11

You can't add custom code on LaunchScreen, so the alternative to achieve this is to use an ImageView

Try to look at iOS 8 - Background gradient for launch screen file

Giuseppe Sapienza
  • 4,101
  • 22
  • 23