Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable dark mode for all UIViewControllers without using Any BaseUIViewController? [duplicate]

I read Apple Article for disable Dark Mode because I need disable for my all UIViewController and i haven't any BaseUIViewController.

How can I disable Dark Mode for all UIViewController without using any BaseUIViewController? I don't want to write the following code over and over again.

Is there a solution to this?

override func viewDidLoad() {
    super.viewDidLoad()

    // Always adopt a light interface style.    
    overrideUserInterfaceStyle = .light
}
like image 973
Mehmet Salih Aslan Avatar asked Jun 28 '19 09:06

Mehmet Salih Aslan


People also ask

How do I opt out of dark mode?

Here's how: Go to Settings. Select Display & Brightness. Turn Dark Mode on or off.

How do I turn off dark mode for certain apps on Android?

On your phone, open the Settings app. Tap Display. Turn Dark theme on or off.

How do I make only one app light up?

Android MessagesIn Messages, tap the three-dot menu and select Choose Theme from the drop-down. You can then make the app light, dark, or match it to the system default theme.

How do I turn off dark mode in Xcode?

If you don't want to use Dark interface style or you have an existing app and you don't have much time to implement dark mode changes, in that case, you can simply disable it by adding the UIUserInterfaceStyle to your Info. plist and set it to Light .


1 Answers

You can force light/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.

like image 105
Dávid Pásztor Avatar answered Oct 07 '22 21:10

Dávid Pásztor