如何将号码面设置为姓名电话键盘键盘类型的默认值(当键盘处于打开状态时) [英] How to set number side as default (while keyboard is open) of name phone pad keyboard type

查看:175
本文介绍了如何将号码面设置为姓名电话键盘键盘类型的默认值(当键盘处于打开状态时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,当键盘在我的应用程序上启动时,它默认为显示字母键盘的字母侧.

Right now when the keyboard launches on my application it defaults to the letter side showing an alphabetical keyboard.

问题将在图片下方列出

请参考下图:

这是.单击123将显示数字面.

This is good. Clicking 123 will show the number side.

问题:

但是,默认情况下,我想显示数字面,并且以后在键盘打开时仍能够切换回字母面.我该怎么做?

以编程方式将键盘设置为其他类型不是答案!

Setting the keyboard programmatically to a different type is NOT the answer!

例如:用户单击文本字段,弹出键盘,默认为ABC端.用户可以单击123进行切换. 这就是我想要的.如果取消了在键盘打开时进行切换的功能,那么这个问题就不成立了.

For example: User clicks in the text field, keyboard pops up and defaults to let's say the ABC side. The user can click 123 to switch. This is what I want. If the ability to switch while the keyboard is open is taken away it defeats the point of this question.

因此,如果名称电话键盘"键盘最初默认为ABC一侧.我希望在键盘仍处于打开状态时将其默认设置为123侧,当用户单击ABC时它可以再次切换到ABC.

我要这样做是因为我对条形码的搜索方式有不同的设置.根据产品名称或编号,基于用户设置的有关如何对结果建立索引的设置.这样,如果他们按数字排序,则它会首先建议数字,但是如果需要,他们仍然可以按键盘上的ABC按钮返回按字母搜索.

I want to do this because I have different settings for how to search for barcodes. Either by name of the product or number based on settings the user set about how to index results. This way if they are sorting by number it suggests numbers first, BUT they can still go back to searching by alphabetical if they wanted by clicking the ABC button on the keyboard.

这是我键盘的当前设置.

Here is the current setting for my keyboard.

推荐答案

keyboardType UITextField 的属性.

textField.keyboardType = UIKeyboardType.UIKeyboardTypeNumberPad

textField.keyboardType = UIKeyboardType.UIKeyboardTypeDefault

是如何以编程方式在两种模式之间切换.希望有帮助.

is how you can switch between the two modes programatically. Hope that helps.

这篇关于如何将号码面设置为姓名电话键盘键盘类型的默认值(当键盘处于打开状态时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆