开发者

iPhone Text Field>Format Input String as a Credit Card Number As They Type [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist

Closed 9 years ago.

Improve this q开发者_如何学Gouestion

How can I format a users text field input as they type and insert a "-" or " " on every 5th character.

4500000000000000 becomes 4500 0000 0000 0000


Make a delegate for your text field, then implement -textField:shouldChangeCharactersInRange:replacementString: to update the text field whenever the user types / pastes anything.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜