Which UIKeyboardType can I use on the iPad

后端 未结 2 1331
萌比男神i
萌比男神i 2020-12-19 07:10

I have a a textField object in my iPad app. I would like to give the user a convenient keyboard for entering numbers. In my code I added:

UITextField *textFi         


        
相关标签:
2条回答
  • 2020-12-19 08:00

    These are the UIKeyboardTypes that can be used on both iOS devices. From 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.

    Here are some screenshots of the different types of keyboards.

    0 讨论(0)
  • 2020-12-19 08:04

    I tested which keyboard types are available for iPad/iPhone using the Simulator after receiving the warning

    "Can't find keyplane that supports type 8 for keyboard Wildcat-Landscape-QWERTY-Pad; using 2592645918_Wildcat-Alphabetic-Keyboard_Capital-Letters"

    on the iPad for the UIKeyboardTypeDecimalPad. Hopefully this is useful for the next person that stumbles here.

    iPad:

    • UIKeyboardTypeASCIICapable
    • UIKeyboardTypeNumbersAndPunctuation
    • UIKeyboardTypeURL
    • UIKeyboardTypeNumberPad
    • UIKeyboardTypeNamePhonePad
    • UIKeyboardTypeEmailAddress
    • UIKeyboardTypeTwitter

    So, all of them except UIKeyboardTypeDecimalPad. using UIKeyboardTypeDecimalPad gets you nothing but a slap on the wrist in either iOS 5.1 or 6.1.

    iPhone:

    • UIKeyboardTypeASCIICapable
    • UIKeyboardTypeNumbersAndPunctuation
    • UIKeyboardTypeURL
    • UIKeyboardTypeNumberPad
    • UIKeyboardTypeNamePhonePad
    • UIKeyboardTypeEmailAddress
    • UIKeyboardTypeDecimalPad
    • UIKeyboardTypeTwitter

    i.e. all of them

    0 讨论(0)
提交回复
热议问题