【发布时间】:2019-09-25 03:42:39
【问题描述】:
我在 ios 中为条目类型编写了自定义渲染器以添加字母空间。当没有为密码类型设置条目时,它可以工作。如何实现密码输入的这种行为?
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
var element = Element as PassowrdEntry;
if (element == null)
return;
if (!string.IsNullOrEmpty(Element.Text))
{
Control.AttributedText = new NSAttributedString(Element.Text, new UIStringAttributes
{
Font = Control.Font,
KerningAdjustment = 8
});
}
}
【问题讨论】:
-
你想要在字符串的开头、中间或结尾处的字母空格“黑色字符串”?
-
@HimanshuDwivedi 想在每个输入的密码字母之间添加空格。
-
添加空间将自动完成,或者您希望用户在输入密码时应该能够输入空间
-
@HimanshuDwivedi 我想要的是在密码字母(圆点)之间添加字母空格。不加空格
-
@IshanthaKamal 您好,您可以将您的
AttributedText代码执行到Control.TextChanged方法中试一试。
标签: xamarin xamarin.forms xamarin.ios