ios – 我可以在iPad上使用哪种UIKeyboardType

ios – 我可以在iPad上使用哪种UIKeyboardType,第1张

概述我的iPad应用程序中有一个textField对象.我想给用户一个方便的键盘来输入数字.在我的代码中我添加了: UITextField *textField = [[UITextField alloc] initWithFrame:frame];textField.keyboardType = UIKeyboardTypeDecimalPad; 根据文档,这是一个有效的键盘类型,但是当我编辑文本 我的iPad应用程序中有一个textFIEld对象.我想给用户一个方便的键盘来输入数字.在我的代码中我添加了:

UITextFIEld *textFIEld = [[UITextFIEld alloc] initWithFrame:frame];textFIEld.keyboardType = UIKeyboardTypeDecimalPad;

根据文档,这是一个有效的键盘类型,但是当我编辑文本字段时,会出现正常的ASCII键盘.但是,当我将其更改为:

textFIEld.keyboardType = UIKeyboardTypePhonePad;

键盘看起来像这样:

理想情况下,我想要一个只有数字和小数点的键盘但这在iPad上是不可能的?有没有人有一个明确的列表,其中哪些键盘适用于iPhone和iPad?苹果目前还不清楚这一点.我也看到了这个类似的question,但没有一个答案能真正解决我的观点.

解决方法 这些是可以在两个iOS设备上使用的UIKeyboardTypes.从 the docs开始:

UIKeyboardTypeDefault

Use the default keyboard for the current input method. Available in iOS 2.0 and later. Declared in UITextinputTraits.h.

UIKeyboardTypeASCIICapable

Use a keyboard that displays standard ASCII characters. Available in iOS 2.0 and later. Declared in UITextinputTraits.h.

UIKeyboardTypeNumbersAndPunctuation

Use the numbers and punctuation keyboard. Available in iOS 2.0 and later. Declared in UITextinputTraits.h.

UIKeyboardTypeURL

Use a keyboard optimized for URL entry. This type features “.”,“/”,and “.com” prominently. Available in iOS 2.0 and later. Declared in UITextinputTraits.h.

UIKeyboardTypeNumberPad

Use a numeric keypad designed for PIN entry. This type features the numbers 0 through 9 prominently. This keyboard type does not
support auto-cAPItalization. Available in iOS 2.0 and later. Declared in UITextinputTraits.h.

UIKeyboardTypePhonePad

Use a keypad designed for entering telephone numbers. This type features the numbers 0 through 9 and the “*” and “#” characters
prominently. This keyboard type does not support auto-cAPItalization. Available in iOS 2.0 and later. Declared in UITextinputTraits.h.

UIKeyboardTypenamePhonePad

Use a keypad designed for entering a person’s name or phone number. This keyboard type does not support auto-cAPItalization. Available in iOS 2.0 and later. Declared in UITextinputTraits.h.

UIKeyboardTypeEmailAddress

Use a keyboard optimized for specifying email addresses. This type features the “@”,“.” and space characters prominently. Available in iOS 2.0 and later. Declared in UITextinputTraits.h.

UIKeyboardTypeDecimalPad

Use a keyboard with numbers and a decimal point. Available in iOS 4.1 and later. Declared in UITextinputTraits.h.

UIKeyboardTypeTwitter

Use a keyboard optimized for twitter text entry,with easy access to the @ and # characters. Available in iOS 5.0 and later. Declared in UITextinputTraits.h.

UIKeyboardTypeAlphabet

Deprecated. Use UIKeyboardTypeASCIICapable instead. Available in iOS 2.0 and later. Declared in UITextinputTraits.h.

这是一些screenshots of the different types of keyboards.

总结

以上是内存溢出为你收集整理的ios – 我可以在iPad上使用哪种UIKeyboardType全部内容,希望文章能够帮你解决ios – 我可以在iPad上使用哪种UIKeyboardType所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1085731.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存