2012-01-19 34 views
0

我正在製作一個應用程序,需要撥號盤才能從應用程序撥打電話號碼。 iphone撥號盤非常棒,但無法在我的應用程序中模仿它。 我認爲這樣做的唯一方法是爲每個號碼分別設置按鍵,但與原來的撥號鍵盤看起來非常不同。在您的應用程序中模仿iPhone的撥號盤

回答

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; 
+0

這是一個不錯的選擇,但我需要有一個撥號button.Since這個鍵盤來自屏幕的底部不能找到一種方法,做到這一點。是否可以使用鍵盤將自定義按鈕放置在屏幕的底部。 – agupta

相關問題