Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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>
like image 881
Vesmy Avatar asked Sep 05 '17 14:09

Vesmy


People also ask

What is Rgba in linear gradient?

Linear Gradient - Transparency To add transparency, we use the rgba() function to define the color stops. The last parameter in the rgba() function can be a value from 0 to 1, and it defines the transparency of the color: 0 indicates full transparency, 1 indicates full color (no transparency).


2 Answers

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.

like image 142
lenooh Avatar answered Sep 28 '22 04:09

lenooh


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

like image 28
Giuseppe Sapienza Avatar answered Sep 28 '22 04:09

Giuseppe Sapienza