Upgrade to VS2019 v16.11.5 & Xcode 13 breaking TabbedPage's tab bar background color in iOS

Shantimohan Elchuri 721 Reputation points
2021-10-22T13:47:29.267+00:00

After upgrading to VS 2019 ver 16.11.5 and Xcode 13 recently the background color of tab bar in a TabbedPage is white for all tabs except for the last one with highest index in iOS. It doesn't matter whether it is the 5th one or higher. If there are 7 tabs then the first 6 tabs will have white and only the 7th will get the background color set in code.

Before the update there was no issue. Xcode 13 only added iPhone 13 simulators.

Developer technologies | .NET | Xamarin
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,436 Reputation points Microsoft External Staff
    2021-10-25T09:30:23.65+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    This is caused by the new feature of iOS15, scrollEdgeAppearance must be set.
    You could try to add the following code in AppDelegate.cs to set the title color, backgroundcolor and so on.

     public override bool FinishedLaunching(UIApplication app, NSDictionary options)  
            {  
                global::Xamarin.Forms.Forms.Init();  
                if (UIDevice.CurrentDevice.CheckSystemVersion(15, 0))  
                {  
                    var appearance = new UITabBarAppearance();  
                    UITabBarItemAppearance tabBarItemAppearance = new UITabBarItemAppearance();  
                    appearance.BackgroundColor = UIColor.Brown;  
                    tabBarItemAppearance.Normal.TitleTextAttributes = new UIStringAttributes() { ForegroundColor = UIColor.Green };  
                    tabBarItemAppearance.Selected.TitleTextAttributes = new UIStringAttributes() { ForegroundColor = UIColor.Yellow };  
                    appearance.StackedLayoutAppearance = tabBarItemAppearance;  
                    UITabBar.Appearance.StandardAppearance = appearance;  
                    UITabBar.Appearance.ScrollEdgeAppearance = appearance;  
                    UITabBar.Appearance.SelectedImageTintColor = UIColor.Red;  
                }  
                LoadApplication(new App());  
                return base.FinishedLaunching(app, options);  
            }  
    

    For more information, you can refer to
    https://stackoverflow.com/questions/68688270/ios-15-uitabbarcontrollers-tabbar-background-color-turns-black
    https://developer.apple.com/forums/thread/682420
    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 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.