iPhone UITextField mask
Is there built in support for input masks in UITextField? I could apply formatting after the text has been entered, but I'd like it to be there as the user is enter开发者_开发问答ing text.
If there is no build in support, how can tis be achieved?
The iPhone doesn't support formatters like Cocoa does. You have to manage input filtering in the UITextFieldDelegate method:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
This method is called before any text appears in the field.
精彩评论