我需要在用戶點擊UITextField
時彈出鍵盤。我明白這是自動完成的。但我需要的鍵盤應該有.com
,@
標誌。就像iOS的Facebook應用程序一樣。單擊文本字段時添加UIKeyboard
如何添加此鍵盤?它叫什麼?
我需要在用戶點擊UITextField
時彈出鍵盤。我明白這是自動完成的。但我需要的鍵盤應該有.com
,@
標誌。就像iOS的Facebook應用程序一樣。單擊文本字段時添加UIKeyboard
如何添加此鍵盤?它叫什麼?
你的答案可以在這裏找到:Programmatically change UITextField Keyboard type
總結...
您可以通過執行更改鍵盤類型如下:
[textField setKeyboardType:(TYPE)];
具有下列之一的更換(TYPE)
:
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).
你正在尋找的一個(顯示@和.com)是UIKeyboardTypeEmailAddress
實現這個
-(void)textFieldDidBeginEditing:(UITextField *)sender{
[textField setKeyboardType:UIKeyboardTypeEmailAddressL];
}
如果您使用Interface Builder創建了UITextField
,然後導航到屬性檢查器,然後更改鍵盤到E-郵件地址。
如果你創造了它編程,然後添加此
[yourTextField setKeyboardType:UIKeyboardTypeEmailAddress];
或
yourTextField.keyboardType=UIKeyboardTypeEmailAddress;
您可以通過訪問你的答案http://stackoverflow.com/questions/7301018/programmatically-change-uitextfield -keyboard-type - 設置爲UIKeyboardTypeEmailAddress – 2012-03-20 16:04:17