在xamarin ios数字键盘中添加减号按钮



我需要允许用户在IOS项目的xamarin应用程序输入字段中输入负值。目前,我使用以下自定义渲染器来使用数字和标点符号键盘。但我不想要一个只输入数字的字母数字键盘。有更好的解决方案吗?

public class NumericKeypadRenderer: EntryRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (Control == null) return;

Control.KeyboardType = UIKeyboardType.NumbersAndPunctuation;

}
}

有没有一种方法可以在IOS中的数字键盘上添加一个减号按钮?

我们不能只在默认键盘上添加自定义按钮。我们需要自定义键盘来实现这一点。

你可以按照这个线程创建你的键盘:Xamarin表单中的自定义键盘

这个链接中有一个示例,您可以参考他的自定义渲染器:https://github.com/Eren-Shen/CustomKeyboardDemo/tree/master/CustomKeyboardDemo/CustomKeyboardDemo.iOS

最新更新