2009-07-22 70 views

回答

7
typedef enum { 
    UIKeyboardTypeDefault, 
    UIKeyboardTypeASCIICapable, 
    UIKeyboardTypeNumbersAndPunctuation, 
    UIKeyboardTypeURL, 
    UIKeyboardTypeNumberPad, 
    UIKeyboardTypePhonePad, 
    UIKeyboardTypeNamePhonePad, 
    UIKeyboardTypeEmailAddress, 
    UIKeyboardTypeDecimalPad, 
    UIKeyboardTypeTwitter, 
    UIKeyboardTypeWebSearch, 
    UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable // Deprecated 
} UIKeyboardType; 

如果你不喜歡這些,你可以隨時修改他們的代碼......

http://openradar.appspot.com/6635276

這有一個解決方案: http://www.iphonedevsdk.com/forum/iphone-sdk-development/6573-howto-customize-uikeyboard.html

+15

我知道這是一個老話題,但任何人誰碰到這個涉及應注意,由於iOS 4.1的,有在枚舉稱爲UIKeyboardTypeDecimalPad定義了一個新UIKeyboardType。 – 2011-02-11 12:58:18

+1

如果您想輸入正數和負數小數,有沒有什麼好的解決方法? – 2012-10-26 12:12:07

0

的iPhone SDK目前不不提供鍵盤(0-9)+小數點按鈕UIKeyboard。我懷疑這是因爲大多數使用情況而設計的,因此不需要。

請參閱this previous StackOverflow question討論貨幣投入的小數分隔符(不需要)。我還寫了關於這個話題的blog post

但是,如果您確實需要鍵盤+小數點按鈕鍵盤,您唯一的選擇將是滾動您自己的自定義鍵盤。相反sbwoodside的答案,你真的想回避定製現有的UIKeyboard。雖然這可能很容易做到,但它依賴於隨時可能改變的私人課程......這意味着您的黑客未來可能會在未經警告的情況下破解。

+0

不幸的是,在我的情況下,我不處理固定的小數位,所以我確實需要一個小數點。您的博客文章的解決方案現在可以工作。 您的解決方案只適用於某些情況。 – 2009-08-23 18:21:01

1

UIKeyboardTypeNumbersAndPunctuation可能是最不錯的選擇,除非您有足夠的時間和資源推出自己的鍵盤。

9

你可以試試這個

UIKeyboardTypeDecimalPad