I want to have commas dynamically added to my numeric UITextField
entry while the user is typing.
For example: 123,456
and 12,345,678
, but not like this 123,45
or 123,4567
.
How does one automatically append the commas while a user is typing a number in Objective-C?
Edit: I'd also like to be able to allow the user to input decimals.
EDIT See Lindsey Scott's answer for an updated, correct version.
This is based on Lindsey Scott's previous answer, but updated to account for 0's entered after the decimal:
Windy please keep in mind the commas should get add to the number itself, not like user has to enter them.
First
You have to change to change the Text yourself. And the Code that will add the commas is