Dark mode fixes, Xamarin.IOS

This blog helps you fix dark mode issues in your mobile applications

Introduction 
 
iOS 13 Introduces dark mode. It adds a dark theme to IOS, and the same color scheme switch happens with our applications, with text boxes and other controls displaying a dark background.
 
The best way to handle the switch between light and dark mode is to create different themes for our modes and change them accordingly. But what if we don't have the time? We can disable dark mode for our application, and it will behave the same way it was working before.
 
If the change is required globally, we need to add key  <key>UIUserInterfaceStyle</key> and set it to Light, as shown below:
 
 
 
If we want to change a particular controller, we need to add the following lines in ViewdidLoad()
 
OverrideUserInterfaceStyle = UIUserInterfaceStyle.Light;
 
For a single view, we can change it with the following code:
 
this.OverrideUserInterfaceStyle = UIUserInterfaceStyle.Light;
 
In this blog, we learned how we can set the light mode globally, at the Controller, and at the View levels.
 
Happy Coding :)