Search code examples
iosxamarin.iosuinavigationbarbackground-color

NavigationBar tint Color with Hex value does not work well in iOS


If I am set UIColor.Red in the NavigationBar it is work Perfect.

Code :

this.NavigationController.NavigationBar.BarTintColor = UIColor.Red;
this.NavigationController.NavigationBarHidden = false;

Output:

enter image description here

But If i set Hex color it is display some other color not actual I want

this.NavigationController.NavigationBar.BarTintColor = UIColor.Clear.FromHexString("#0072BA", 1.0f);
this.NavigationController.NavigationBarHidden = false;

Output :

enter image description here

Actual Output Color :

enter image description here

Note :

I also set color using FromRGB but that also display different color.

Is there any property I miss then tell me because I am new to Xamarin and Ios.

Any Help be Appreciated.

Simple Question :

InBuild color work but why Hex Color code not work.


Solution

  • By the Combine of My idea and @KKRocks Solution now is work for me is below thing.

    Use this code :

    this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(0,114,186);
    this.NavigationController.NavigationBar.Translucent = false;