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
Format the number with grouping attributes as shown here.
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setGroupingSeparator:@","];
[numberFormatter setGroupingSize:3];
[numberFormatter setDecimalSeparator:@"."];
[numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
[numberFormatter setMaximumFractionDigits:3];
[numberFormatter setMinimumFractionDigits:3];
Output for the above code is
1,234,567.850