How can I show the numeric keyboard by default on iPhone?

前端 未结 5 655
無奈伤痛
無奈伤痛 2020-12-29 01:22

I\'m trying the following with no luck. When the user click on a UiTextfield I need to change the keyboard view to the numeric view automatically, is this possible?

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-29 01:55

    The UITextInputTraits protocol (which UITextField conforms to) has a keyboardType property of type UIKeyboardType.

    myTextField.keyboardType = UIKeyboardTypeNumberPad;
    

提交回复
热议问题