Home > OS >  Xamarin.iOS does not paint secondary toolbar in the requested color
Xamarin.iOS does not paint secondary toolbar in the requested color

Time:04-07

In my Xamarin project, in the header of the XAML file, I have set:

 Shell.BackgroundColor="DarkGreen"

Part of xaml header declaration looks like that:

xaml header declaration

On Android all things are ok (check the picture below), but on iOS the secondary toolbar (shown in red square) is white, and I can't understand why does it happen and how can I fix this issue?

Secondary toolbar appearance on Android

CodePudding user response:

You can add on itemsApp->AppDelegate.cs->FinishedLaunching method:

if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
{
    UITabBar.Appearance.TintColor = UIColor.Blue;
    UINavigationBar.Appearance.BackgroundColor = UIColor.Blue;
}

The complete method for FinishedLaunching is:

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
    global::Xamarin.Forms.Forms.Init();
    LoadApplication(new App());

    if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
    {
        UITabBar.Appearance.TintColor = UIColor.Blue;
        UINavigationBar.Appearance.BackgroundColor = UIColor.Blue;
    }

    return base.FinishedLaunching(app, options);
}
  • Related