0

我正在寻找一种将我的普通 html 文本字段转换为 Ipad 的 Numpad 字段的方法。所以当用户在 Ipad 的字段中点击输入数字时,它会自动在 Ipad 上显示小键盘,用户不必从字符键盘中选择小键盘。

此致。

4

1 回答 1

0

以下枚举是为键盘类型定义的 -

typedef enum {
    UIKeyboardTypeDefault,                // Default type for the current input method.
    UIKeyboardTypeASCIICapable,           // Displays a keyboard which can enter ASCII characters, non-ASCII keyboards remain active
    UIKeyboardTypeNumbersAndPunctuation,  // Numbers and assorted punctuation.
    UIKeyboardTypeURL,                    // A type optimized for URL entry (shows . / .com prominently).
    UIKeyboardTypeNumberPad,              // A number pad (0-9). Suitable for PIN entry.
    UIKeyboardTypePhonePad,               // A phone pad (1-9, *, 0, #, with letters under the numbers).
    UIKeyboardTypeNamePhonePad,           // A type optimized for entering a person's name or phone number.
    UIKeyboardTypeEmailAddress,           // A type optimized for multiple email address entry (shows space @ . prominently).
    #if __IPHONE_4_1 <= __IPHONE_OS_VERSION_MAX_ALLOWED
    UIKeyboardTypeDecimalPad,             // A number pad with a decimal point.
    #endif
    #if __IPHONE_5_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
    UIKeyboardTypeTwitter,                // A type optimized for twitter text entry (easy access to @ #)
    #endif

    UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable, // Deprecated

} UIKeyboardType;

您可以根据需要选择合适的键盘类型。与文本字段一样 -

textField.keyboardType = UIKeyboardTypeNumberPad;
于 2012-06-25T07:03:45.633 回答