Allow only alphanumeric characters for a UITextField

前端 未结 7 958
野性不改
野性不改 2020-11-27 17:44

How would I go about allowing inputting only alphanumeric characters in an iOS UITextField?

7条回答
  •  执笔经年
    2020-11-27 18:21

    You will have to use the textField delegate methods, and use methods textFieldDidBeginEditing, shouldChangeCharactersInRange and textFieldDidEndEditing to check for the characters.

    Please refer to this link for the documentation.

提交回复
热议问题