在您的应用程序内模仿iphone的拨号盘

时间:2012-01-19 23:01:01

标签: iphone ios5

我正在制作一个需要拨号盘才能从应用程序拨打电话号码的应用程序。 iphone拨号盘很棒,但无法在我的应用程序中模仿它。 我想到的唯一方法就是为每个数字设置单独的按钮,但它看起来与原来的拨号盘非常不同。

1 个答案:

答案 0 :(得分:2)

如果您有UITextField,则可以设置keyboardType属性,以便在用户关注时显示数字键盘。

UITextField *textField;
textfield.keyboardType = UIKeyboardTypePhonePad;

keyboardType可以是enum

中的任何内容
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).

    UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable, // Deprecated

} UIKeyboardType;