简体   繁体   English

Xamarin.Forms 如何更改 ios 上的默认蓝色

[英]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?任何人都知道我必须改变什么以及在哪里改变?

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. 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.

相关问题 如何在表单xamarin中将开关设置为“on”(蓝色到绿色)时更改默认颜色。 在ios默认它是GReen但在android中它是蓝色的 - how to change default color when switch is “on”(blue to green) in forms xamarin. In ios default it is GReen but in android it is blue 如何在IOS Xamarin.Forms中更改浮动文本字段默认占位符颜色 - How to Change Floating TextField Default Placeholder Color in IOS Xamarin.Forms 如何更改 Xamarin.Forms ios 中的工具栏图标颜色 - how to change toolbar icon color in Xamarin.Forms ios 如何更改工具栏颜色?(xamarin.forms) - How Change toolbar color?(xamarin.forms) 如何使用自定义渲染器更改 Xamarin.Forms、Android、iOs、UWP 上的滑块颜色? - How to Change the Color of Slider on Xamarin.Forms, on Android, iOs, UWP using custom renderers? 如何在IOS Xamarin.forms中隐藏选项卡顶部边框颜色 - How to Hide Tabbar Top Border color in IOS Xamarin.forms 如何更改MasterPageDetalis xamarin.forms上菜单图标的颜色? - How to change the color of the menu icon on the MasterPageDetalis xamarin.forms? 如何使用Xamarin.Forms更改标题中字体的颜色? - How can I change the color of the font in the Title with Xamarin.Forms? Xamarin.Forms 应用程序在 IOS 上显示蓝屏,然后应用程序关闭 - Xamarin.Forms app shows blue screen on IOS then the app closes 更改 Xamarin.Forms 中 ScrollBar 的颜色 - Change the color of the ScrollBar in Xamarin.Forms
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM