IOS 11.1 - Navigation bar text - hard to see

jerryjohansson.2662jerryjohansson.2662 USMember
edited November 2017 in Xamarin.iOS

Since the release of IOS 11.1, the text of the top bar navigation items have been hard to read.
I had to set the NavigationItem.Left and Right's TitleTextAttributes to make them visible.
Example:

        UITextAttributes textAttributes = new UITextAttributes();
        textAttributes.TextColor = UIColor.Black;
        this.NavigationItem.LeftBarButtonItem.SetTitleTextAttributes(textAttributes, UIControlState.Normal);
        this.NavigationItem.RightBarButtonItem.SetTitleTextAttributes(textAttributes, UIControlState.Normal);

I can not find a way to set the "< Home" or the back button text attribute on the right item.
Anyone have had a similar problem? The color on the text is default set to the same as the background.
This is since update of IOS11.1. IOS10 it was all fine.

Best Answer

  • TedRogersTedRogers US ✭✭✭✭
    Accepted Answer

    @jerryjohansson.2662 You should be able to handle this using appearance or directly on your navigation bar using the BarTintColor (background) and TintColor (Foreground). Here is a small piece of code I use for configuring one of my nav bars.

    navigationBar.SetItems(new[] { navItem }, false);
    navigationBar.BarTintColor = barTintColor;
    navigationBar.Translucent = false;
    navigationBar.TintColor = tintColor;
    navigationBar.TitleTextAttributes = new UIStringAttributes() { ForegroundColor = tintColor };
    navigationBar.Delegate = new NavigationBarDelegate();
    

Answers

  • TedRogersTedRogers USMember ✭✭✭✭
    Accepted Answer

    @jerryjohansson.2662 You should be able to handle this using appearance or directly on your navigation bar using the BarTintColor (background) and TintColor (Foreground). Here is a small piece of code I use for configuring one of my nav bars.

    navigationBar.SetItems(new[] { navItem }, false);
    navigationBar.BarTintColor = barTintColor;
    navigationBar.Translucent = false;
    navigationBar.TintColor = tintColor;
    navigationBar.TitleTextAttributes = new UIStringAttributes() { ForegroundColor = tintColor };
    navigationBar.Delegate = new NavigationBarDelegate();
    
  • Thank you very much @TedRogers, perfect!!!

Sign In or Register to comment.