Views stuck in night mode?

Chris K 21 Reputation points
2022-01-18T18:55:02.013+00:00

Since iOS 15, all my views (except the main starting view) seem to be in dark mode, as in the top bar and bottom tool bar are in black, kind of like a negative. And in some views, only the bottom tool bar is black but the top bar is normal.

I have tried this in info.plist:

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

I have added this to the view ViewDidLoad():

if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
OverrideUserInterfaceStyle = UIUserInterfaceStyle.Light;

but nothing seems to make a difference, the unit itself is set for light mode and not dark mode so not sure why these views are doing this.
Any hints would be appreciated.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,292 questions
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 26,146 Reputation points Microsoft Vendor
    2022-01-19T06:11:20.977+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    The top bar is UINavigationBar and bottom bar is UITabBar. You said "only the bottom tool bar is black but the top bar is normal " , it caused by the Appearance of UITabBar, you could add the following code to FinishedLaunching method in Appdelegate.cs

        var appearance = new UITabBarAppearance();  
        appearance.BackgroundColor = UIColor.White;  
        UITabBar.Appearance.StandardAppearance = appearance;  
        UITabBar.Appearance.ScrollEdgeAppearance = appearance;  
    

    If you want to customize the tabBarItem, you coud try to update UITabBarItemAppearance

        //UITabBarItemAppearance tabBarItemAppearance = new UITabBarItemAppearance();  
        //tabBarItemAppearance.Normal.TitleTextAttributes = new UIStringAttributes() { ForegroundColor = UIColor.DarkGray, Font = UIFont.SystemFontOfSize(12) };  
        //tabBarItemAppearance.Selected.TitleTextAttributes = new UIStringAttributes() { ForegroundColor = UIColor.Red };  
        //appearance.StackedLayoutAppearance = tabBarItemAppearance;  
    

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful