How to set number side as default (while keyboard is open) of name phone pad keyboard type

后端 未结 2 1805
逝去的感伤
逝去的感伤 2021-02-19 08:45

Right now when the keyboard launches on my application it defaults to the letter side showing an alphabetical keyboard.

Question will be listed below images

相关标签:
2条回答
  • 2021-02-19 09:09

    keyboardType is property for a UITextField.

    textField.keyboardType = UIKeyboardType.UIKeyboardTypeNumberPad
    

    and

    textField.keyboardType = UIKeyboardType.UIKeyboardTypeDefault
    

    is how you can switch between the two modes programatically. Hope that helps.

    0 讨论(0)
  • 2021-02-19 09:13

    To switch the Keyboardlayout programmatically you have to mutate UITextfield's keyboardType attribute.

    Try

    textField.keyboardType = UIKeyboardType.NumberPad;
    

    or

    textField.keyboardType = UIKeyboardType.PhonePad;
    
    0 讨论(0)
提交回复
热议问题