开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜