16

How can I choose a different set of Launch images for Dark mode and for Light mode?

I have a LaunchImages set. When the application starts, an image is shown. For Light mode it seems good, however if I try to open my application on a device set to Dark mode (iOS 13), this image seems bad.

During the start application I can not use any code for dynamic changes and I have no options in XCode interface for managing it.

TylerH
  • 20,799
  • 66
  • 75
  • 101
gerram
  • 520
  • 6
  • 12

5 Answers5

25

As the Launch Screen loads before the app starts executing, it would not be possible to change the launch images set programmatically.

However, in the Image Set tab, you can change the Appearance option to enable a different set of images for Light and Dark modes:

enter image description here

So, if you set this image in the Launch Screen Storyboard, the result would be as below:

enter image description here

On a side note, if the need is just to change the background color, not the images, you may set the Launch Screen Storyboard view background color to System Background Color and just use transparent PNG images.

TylerH
  • 20,799
  • 66
  • 75
  • 101
alxlives
  • 5,084
  • 4
  • 28
  • 50
  • What is different between any, dark and any, light ,dark? – nimesh surani Oct 23 '19 at 07:21
  • 2
    "Any, dark" lets you specify two appearance variations (one for light / any ie older versions). "Any, light, dark" lets you specify three, which you might want if you wanted to vary the appearance between devices that don't support light/dark mode and light mode on devices that do support it. – shim Aug 17 '20 at 20:46
  • "System Background Color" does not work for me... Background always stays white. – Alexander Dyagilev May 26 '23 at 04:58
4
  1. Xcode 11 supports only storyboard Launch screen files. It means I should use storyboards.
  2. In storyboards we can use UIImageViews + images from .xcassets. Assets support images with different variants: Light, Dark modes. You can apply constraints for positioning them on screen.
  3. If you support iOS before 11.0 you can not use system dynamic colors for backgrounds of the screen view. In this case you put additional dynamic image to screen as background and apply leading, trailing, top and bottom constraints with negative values. Negative values are needed for covering Top and Bottom Bars. (I used -64px)
gerram
  • 520
  • 6
  • 12
3

You need to add dark appearance for your asset, or for the asset color you are using, like in the image below:

enter image description here

M. Mansuelli
  • 1,083
  • 9
  • 19
2

You should do something like this to use light and dark mode images

  1. Step 1 - Create image set in assets.xassets like this enter image description here

  2. Step 2 - Select Image select like this

enter image description here

  1. Steps 3 - Change appearance to Any, Light , Dark like this enter image description here

enter image description here

  1. Add your images for any light and dark mode like this and use this image wherever you need it

enter image description here

Quick learner
  • 10,632
  • 4
  • 45
  • 55
1

Just for my experience, sometimes Launch image is changed when you erase your app, turn off your device and turn on again.

Kyle Yi
  • 448
  • 4
  • 11
  • yep I was about to pull my hair out - why does it not work on my device. works after a reboot of device, just re-installing app wasn't enough.. – Samuël Aug 30 '23 at 09:50