具有十六进制值的 NavigationBar 色调颜色在 iOS 中效果不佳
NavigationBar tint Color with Hex value does not work well in iOS
如果我在 NavigationBar 中设置 UIColor.Red
就完美了。
代码:
this.NavigationController.NavigationBar.BarTintColor = UIColor.Red;
this.NavigationController.NavigationBarHidden = false;
输出:
但是如果我设置 Hex color
它会显示一些其他颜色而不是我想要的实际颜色
this.NavigationController.NavigationBar.BarTintColor = UIColor.Clear.FromHexString("#0072BA", 1.0f);
this.NavigationController.NavigationBarHidden = false;
输出:
实际输出颜色:
Note :
I also set color using FromRGB
but that also display different
color.
有没有 属性 我想念然后告诉我,因为我是 Xamarin 和 Ios.
的新手
感谢任何帮助。
简单的问题:
InBuild 颜色有效,但为什么十六进制颜色代码无效。
您需要为 naviagtionbar 禁用此 属性。
NavigationController.NavigationBar.Translucent = false;
Combine of My idea
和 @KKRocks Solution
现在对我来说是下面的事情。
使用此代码:
this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(0,114,186);
this.NavigationController.NavigationBar.Translucent = false;
如果我在 NavigationBar 中设置 UIColor.Red
就完美了。
代码:
this.NavigationController.NavigationBar.BarTintColor = UIColor.Red;
this.NavigationController.NavigationBarHidden = false;
输出:
但是如果我设置 Hex color
它会显示一些其他颜色而不是我想要的实际颜色
this.NavigationController.NavigationBar.BarTintColor = UIColor.Clear.FromHexString("#0072BA", 1.0f);
this.NavigationController.NavigationBarHidden = false;
输出:
实际输出颜色:
Note :
I also set color using
FromRGB
but that also display different color.
有没有 属性 我想念然后告诉我,因为我是 Xamarin 和 Ios.
的新手感谢任何帮助。
简单的问题:
InBuild 颜色有效,但为什么十六进制颜色代码无效。
您需要为 naviagtionbar 禁用此 属性。
NavigationController.NavigationBar.Translucent = false;
Combine of My idea
和 @KKRocks Solution
现在对我来说是下面的事情。
使用此代码:
this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(0,114,186);
this.NavigationController.NavigationBar.Translucent = false;