How to change UITextField keyboard type to email in Swift

后端 未结 6 1201
伪装坚强ぢ
伪装坚强ぢ 2021-01-30 20:36

In objective-c I can just say the following.

[self.promoTextField setKeyboardType:UIKeyboardTypeEmailAddress];

I tried googling it but just ge

6条回答
  •  名媛妹妹
    2021-01-30 20:59

    The documentation about UITextInputTraits, a protocol adopted by UITextField, says it's still here:

    optional var keyboardType: UIKeyboardType { get set }
    

    And the list of all keyboardTypes is here :

    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
    }
    

提交回复
热议问题