How to set linear gradient to background of LaunchScreen.xib in iOS

18.9k views Asked by At

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>
2

There are 2 answers

0
Giuseppe Sapienza On BEST ANSWER

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

1
lenooh On

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.