views:

68

answers:

1

Part of the program I'm developing stores user-entered phone numbers, so I'd like to format them as they are entered. I've got the NSFormatter working when text is displayed in the cell from stored data, but I don't know how to format a phone number as it's being entered on the keyboard, as in Apple's contacts app.

How can I accomplish this?

+1  A: 

Set the delegate of the text field to you controller class, implement the UITextFieldDelegate protocol and put your formatting code in the textField:shouldChangeCharactersInRange:replacementString: method.

kubi
Just what I needed, thanks!
JoBu1324