我正在尝试更改 Entry 的 PlaceHolder 文本颜色
在android中它与EntryRenderer一起工作正常我使用了代码:
Control.SetHintTextColor(global::Android.Graphics.Color.White);
我怎样才能在 ios 中做同样的事情?
如果是Xamarin Forms Application ,有一个简单的方法来PlaceHolder Color设置iOS和Android:
<Label Text="Hello, Custom Renderer!" />
<local:MyEntry Placeholder="input code" PlaceholderColor="Red"/
效果:
顺便说一句,如果需要在 Render for iOS中实现它,这里是解决方案:
var text = new NSAttributedString("Hello, World", foregroundColor: UIColor.Red);
Control.AttributedPlaceholder = text;
您可以设置AttributedPlaceholder来UITextField设置颜色。