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
Use the UITextFieldDelegate method: (your view controller needs to be a delegate of the textfield)
-(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
When a character is added to the textField, it will call this method. You can then insert commas wherever you want.
Note: people can paste text into textfields, delete values, move the cursor, etc. so you have a lot of tests to consider.
There are lots of similar questions on SO, e.g. How to put comma and decimals in my UITextField dynamically?
Auto suggest in UITextfield with comma separation
etc