UITextField format in xx-xx-xxx

后端 未结 10 1782
暖寄归人
暖寄归人 2020-11-27 04:13

I am using UITextField and i want that should take character in the format of xx-xx-xxx only numbers.

any help ?

10条回答
  •  猫巷女王i
    2020-11-27 04:44

    My google searches tell me that you should implement

    - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 
    

    from the UITextFieldDelegate protocol.

    Have a look at this for more info.

提交回复
热议问题