iOS强制App使用自定义键盘 [英] iOS force App to use custom keyboard
问题描述
我正在开发一个应用程序,它有一个文本字段
,它只能接受数字
所以我创建了一个自定义键盘
只有 [0-9]
作为接受的输入。要使用此自定义键盘
一个必须去设置
- > 键盘
然后接受这个,然后从应用程序打开特定的键盘。
I am working on the app which has a one text-field
which should accept only numbers
so I created one custom keyboard
which has only [0-9]
as input to accept.To use this custom keyboard
one has to go setting
-->keyboards
then accept this and then open particular keyboard from the app.
这是否可以强制用户只打开自定义键盘
而无需进行设置选项。我希望每当用户打开应用程序时.. 仅 自定义键盘
应该打开,而不是其他
Is this possible to force user to open only custom keyboard
without going into setting option. I want whenever user opens the app.. only custom keyboard
should open, not other
推荐答案
您好,您可以使用此代码只是查看您的自定义键盘并添加此行以显示您的键盘而不是默认键盘
Hi you can this using this code just make a view of your custom keyboard and add this line to show your keyboard instead of default keyboard
numericTextField.inputView = your_keyboardView;//here your_keyboardView is the object of the custom keyboard view.
UITextField * numericTextField = [[UITextField alloc] initWithFrame:CGRectMake(100, 10,185,30)];
numericTextField.adjustsFontSizeToFitWidth = YES;
numericTextField.inputView = yuor_keyboardView;
[parentView addSubview:numericTextField];
如果您有任何疑问,请告知我们。
If you have any query then please let me know.
这篇关于iOS强制App使用自定义键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!