Home > front end >  how to get different background color for Launchscreen.storyboard for diff builds in iOS?
how to get different background color for Launchscreen.storyboard for diff builds in iOS?

Time:12-06

Basically there is one Launchscreen.storyboard in iOS and in the project I'm working on i have various environments as in Local, Development, Production.

Can i have three different background colors for the respective builds on the same launchscreen? If yes, then how?

CodePudding user response:

The only way I can think of is adding a Run-Script phase to the Build Phases section. The script should look at the environment variables in order to determine what the current environment is, and replace the relevant XML element inside the storyboard file.

CodePudding user response:

The Launch Screen is set by target not the schemas so you can't do this for the same launchScreen.xib file.

Maybe a solution would be to make a viewcontroller for the launch screen, but that's not possible either. Even if possible, The launch screen appears instantly when your app starts up. So writing some code in launchScreen's viewcontroller would be pointless

CodePudding user response:

To set a different background color for the Launchscreen.storyboard file for different builds in iOS, you can follow these steps:

Open the Launchscreen.storyboard file in Xcode.

Select the view controller that you want to change the background color of.

In the Attributes inspector, find the View section and click on the Background color field.

Select the color that you want to use as the background color for this build.

To set a different background color for another build, you can repeat these steps and select a different color for the background in step 4.

When you are finished, you can build your app and the different background colors will be used for the specified builds.

It is important to note that you may need to set up different build configurations in Xcode in order to use different background colors for different builds. This can be done in the project settings, and you can specify the build configuration to use for each build.

  • Related