2012-01-09 13 views
1

現在表示されているuikeyboardの種類を知る必要があります。UIkeyboardタイプが現在表示されていますか?

これを見つける方法はありますか?私はこれを検索しましたが、まだ解決策はありません。

私はあなたがするUITextFieldで作業する場合は、 'KEYBOARDTYPE' プロパティで、この情報を得ることができ

+0

インターフェイスビルダーでテキストフィールドまたはテキストビューをチェックインできます。 –

答えて

1

を教えてください:

textField.keyboardType

アップルドック:

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

annoyinglyこれは最初にキーボードタイプを設定したものだけを反映しているようです。例えば。ユーザーが '数字と句読点'に切り替えるとkeyboardTypeは更新されません –

+0

この解決方法は間違っています。coz UITextFieldは認識していません。現在表示されているキーボードはbecomeFirstResponderにのみ表示されます。ユーザーがタイプを変更すると、keyboardTypeは情報を反映しませんが、それはまだdefaultTypeを持ちます。 – HotJard

関連する問題