Xamarin iOS: BarTintColor not working in iOS 15

432 views Asked by At

I came across a similar issue in this post.

I tried to convert iOS native code into Xamarin.iOS C#.

iOS Native Code:

let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = <your tint color>
navigationBar.standardAppearance = appearance;
navigationBar.scrollEdgeAppearance = navigationBar.standardAppearance

my own code for Xamarin.iOS C#

if (UIDevice.CurrentDevice.CheckSystemVersion(15, 0))
{
    var appearance = new UITabBarAppearance();
    appearance.ConfigureWithOpaqueBackground();
    appearance.BackgroundColor = UIColor.FromRGB((float)rgbColorBackground.R, (float)rgbColorBackground.G, (float)rgbColorBackground.B);
    this.TabBarController.TabBar.StandardAppearance = appearance;
}
else
     TabBar.BarTintColor = UIColor.FromRGB((float)rgbColorBackground.R, (float)rgbColorBackground.G, (float)rgbColorBackground.B);

However, there is no reference to "scrollEdgeAppearance" in Xamarin.iOS C#, and it seems important to add this to solve the issue. I'd be grateful if someone can give me some advice or point out my mistakes.

1

There are 1 answers

0
JoacimWall On

I did this to solve transparent tabbar in IOS 15.

public override bool FinishedLaunching(UIApplication app, NSDictionary options)

// Color of the selected tab icon: UITabBar.Appearance.SelectedImageTintColor = AppColors.Primary500Color.ToUIColor(); UITabBar.Appearance.BackgroundColor = AppColors.WhiteColor.ToUIColor(); if (UIDevice.CurrentDevice.CheckSystemVersion(15, 0)) UITabBar.Appearance.ScrollEdgeAppearance = new UITabBar().StandardAppearance;

Regards Joacim