Filtering characters entered into a UITextField

前端 未结 7 1007
猫巷女王i
猫巷女王i 2020-12-14 03:54

I have a UITextField in my application. I\'d like to restrict the set of characters that can be can be entered into the field to a set that I have defined. I could filter th

相关标签:
7条回答
  • 2020-12-14 04:36

    Look at textField:shouldChangeCharactersInRange

    This method is called by the UITextFieldDelegate whenever new characters are typed or existing characters are deleted from the text field. You could return NO to not allow the change.

    0 讨论(0)
提交回复
热议问题