I'm creating mobile app in 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.
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?
From the document :
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.
This functionality is exposed in Xamarin.iOS via a static Appearance
property on all UIKit controls that support it.
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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.