use*_*829 47 uitextfield swift
在objective-c中,我可以说以下内容.
[self.promoTextField setKeyboardType:UIKeyboardTypeEmailAddress];
Run Code Online (Sandbox Code Playgroud)
我试着谷歌搜索它,但只是想方设法在objective-c中做到这一点.
Pin*_*uch 126
试试这个 :
self.promoTextField.keyboardType = UIKeyboardType.emailAddress
Run Code Online (Sandbox Code Playgroud)
self.promoTextField.keyboardType = UIKeyboardType.EmailAddress
Run Code Online (Sandbox Code Playgroud)
Cyr*_*lle 15
有关文档UITextInputTraits,通过的一项协议UITextField,说这是仍然在这里:
optional var keyboardType: UIKeyboardType { get set }
Run Code Online (Sandbox Code Playgroud)
所有keyboardTypes 的列表在这里:
enum UIKeyboardType : Int {
case Default
case ASCIICapable
case NumbersAndPunctuation
case URL
case NumberPad
case PhonePad
case NamePhonePad
case EmailAddress
case DecimalPad
case Twitter
case WebSearch
}
Run Code Online (Sandbox Code Playgroud)
小智 6
在Swift 3你可能会使用:
youremailfieldname.keyboardType = UIKeyboardType.emailAddress
注意lowercase在emailAddress
注意:您还可以
TextField在故事板的定义中分配键盘类型。
| 归档时间: |
|
| 查看次数: |
42429 次 |
| 最近记录: |