I just want override dark mode UI in my application. I added UIUserInterfaceStyle
is Light
. But i am not sure it is not working. Is there any other option?
Asked
Active
Viewed 5,413 times
2

Mojtaba Hosseini
- 95,414
- 31
- 268
- 278

Suyash
- 365
- 5
- 18
-
try this call in appdelegate `if #available(iOS 13.0, *) { // disable dark mode window?.overrideUserInterfaceStyle = .light }` – Anbu.Karthik Oct 02 '19 at 07:25
-
just add userinterfacestyle in your plist and put Light – antonio yaphiar Oct 02 '19 at 07:41
-
not working. @Anbu.Karthik, – Suyash Oct 03 '19 at 04:57
-
@antonioyaphiar not working. – Suyash Oct 03 '19 at 04:57
-
@Suyash - please update your code – Anbu.Karthik Oct 03 '19 at 05:04
3 Answers
5
- For entire App (Window):
window!.overrideUserInterfaceStyle = .light
You can get the window from SceneDelegate
or any view.window
- For a single ViewController:
viewController.overrideUserInterfaceStyle = .light
You can set any viewController
, even inside the viewController itself
- For a single View:
view.overrideUserInterfaceStyle = .light
You can set any view
, even inside the view itself
You may need to use if #available(iOS 13.0, *) { ,,, }
if you are supporting earlier iOS versions.

Mojtaba Hosseini
- 95,414
- 31
- 268
- 278
2
For Objective C entire App:
_window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;

Josep Escobar
- 445
- 4
- 11
2
You can force light or dark mode in your whole application regardless of the user's settings by adding the key UIUserInterfaceStyle to your Info.plist file and setting its value to either Light or Dark.

Rahul Panzade
- 1,302
- 15
- 12