[英]Xamarin.Forms how to change default blue color on ios
I'm creating mobile app in Xamarin.Forms.我正在 Xamarin.Forms 中创建移动应用程序。 I have a problem with ios implementation, I need change default blue color in all button texts, switch etc. to my own color.
我对 ios 实现有疑问,我需要将所有按钮文本中的默认蓝色、切换等更改为我自己的颜色。
In Android I managed this by changing styles.xml and colors.xml but on iOS I have no idea how to change this. In Android I managed this by changing styles.xml and colors.xml but on iOS I have no idea how to change this.
Anyone know what and where I have to change?任何人都知道我必须改变什么以及在哪里改变?
iOS lets you apply visual property settings at a static class level rather than on individual objects so that the change applies to all instances of that control in the application.
iOS 允许您在 static class 级别而不是单个对象上应用视觉属性设置,以便更改适用于应用程序中该控件的所有实例。
This functionality is exposed in Xamarin.iOS via a static Appearance
property on all UIKit controls that support it.此功能在 Xamarin.iOS 中通过 static
Appearance
属性在所有支持它的 Z9CFED124ECBE656AF2584273 控件上公开。
So you can set the default appearance values in the first screen:因此,您可以在第一个屏幕中设置默认外观值:
// Set the default appearance values
UIButton.Appearance.TintColor = UIColor.LightGray;
UIButton.Appearance.SetTitleColor(UIColor.FromRGB(0,127,14), UIControlState.Normal);
UISlider.Appearance.ThumbTintColor = UIColor.Red;
UISlider.Appearance.MinimumTrackTintColor = UIColor.Orange;
UISlider.Appearance.MaximumTrackTintColor = UIColor.Yellow;
UIProgressView.Appearance.ProgressTintColor = UIColor.Yellow;
UIProgressView.Appearance.TrackTintColor = UIColor.Orange;
You can also customize the color by:您还可以通过以下方式自定义颜色:
UIButton button = new UIButton();
button.SetTitleColor(UIColor.Red, UIControlState.Normal);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.