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开发者_如何学GouestionHow 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.
精彩评论