Opting Out of iOS 13 Dark Mode
By Mike Irving - Published: 7/6/2020

Whilst I'd not normally advocate that you ignore new features added to operating systems, particularly those around accessibility, sometimes you may need to.

One of the most obvious new features in iOS 13 / iPad OS 13 was the introduction of a system wide Dark Mode setting.

The rationale, that users should be able to choose whether their devices run in Light Mode or Dark Mode, or have it automatically set based on the time of day, and have all apps respect the setting and adapt their UI.

However, if you have an existing app, and you need to get an update out, you may wish to temporarily opt-out and keep your app looking like it did previously. Other scenarios could be that your application is very complex, with may screens, and you want to opt them in one at a time, when ready. Or perhaps your app doesn't really need to adhere to the setting, maybe it is bright orange, or tartan!


For a blanket opt-out, set the following Key in your info.plist file

info.plist setting

<key>UIUserInterfaceStyle</key>
<string>Light</string>


To opt-out at a granular level, for example in your AppDelegate or an individual ViewController, do so as follows.


Swift example

override func viewDidLoad() {
    super.viewDidLoad()
    
    if #available(iOS 13.0, *) {
        overrideUserInterfaceStyle = .light
    }
}


Objective-C example

- (void)viewDidLoad:(BOOL)animated {
    [super viewDidLoad];
    
    if(@available(iOS 13, *)) {
        window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
    }
}


Xamarin / C# example

public override void ViewDidLoad()
{
    base.ViewDidLoad();
    
    if(UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
    {
        OverrideUserInterfaceStyle = UIUserInterfaceStyle.Light;
    }
}

These settings may not stand the test of time, but for now they work. As time goes on, best practice would be adapting your app to support the new feature.


View Blog Entries...
Page: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11