键盘类型UIKeyboardType

时间:2021-12-02 23:03:19

UITextField、UITextView等能够调出系统键盘的控件,通过下面这个属性可以控制弹出键盘的样式:

self.priceTextField.keyboardType = UIKeyboardTypeDecimalPad;

下面枚举下,常见的13种键盘样式


1.UIKeyboardTypeDefault(当前输入法的默认类型)

键盘类型UIKeyboardType


2.UIKeyboardTypeASCIICapable(显示一个可以输入ASCII字符的键盘)

键盘类型UIKeyboardType


3.UIKeyboardTypeNumbersAndPunctuation(数字和分类标点符号)

键盘类型UIKeyboardType


4.UIKeyboardTypeURL(为URL条目优化的类型(显著的显示“.”、“/”、“.com”))

键盘类型UIKeyboardType


5.UIKeyboardTypeNumberPad(只能输入整数)

键盘类型UIKeyboardType


6.UIKeyboardTypePhonePad(适用于拨号)

键盘类型UIKeyboardType


7.UIKeyboardTypeNamePhonePad(为输入某人的姓名或电话号码而优化的一种类型)

键盘类型UIKeyboardType


8.UIKeyboardTypeEmailAddress(为多个电子邮件地址条目优化的类型(显著的显示@))

键盘类型UIKeyboardType


9.UIKeyboardTypeDecimalPad(带小数点的数字键盘)

键盘类型UIKeyboardType


10.UIKeyboardTypeTwitter(一种优化的Twitter文本条目(易于使用@))

键盘类型UIKeyboardType


11.UIKeyboardTypeWebSearch(输入URL条目推荐的键盘样式,显著的显示Go、搜索)

键盘类型UIKeyboardType


12.UIKeyboardTypeAlphabet == UIKeyboardTypeASCIICapable(官方不建议使用)

键盘类型UIKeyboardType


13、UIKeyboardTypeASCIICapableNumberPad(iOS10后出现的数字键盘)

键盘类型UIKeyboardType