gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 03:27:01 26 4
gpt4 key购买 nike

我的 iPad 应用程序中有一个 textField 对象。我想给用户一个方便的键盘来输入数字。在我的代码中,我添加了:

UITextField *textField = [[UITextField alloc] initWithFrame:frame];
textField.keyboardType = UIKeyboardTypeDecimalPad;

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

textField.keyboardType = UIKeyboardTypePhonePad;

键盘看起来像这样: phonepad keyboard

理想情况下,我想要一个只有数字和小数点的键盘,但这在 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,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11654101/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com