I need to create a UITextField to add money values. But I need the user to see the value being added in the UITextField in the order the user types. Example: User types 1 - in UITextField 0.01 appears User types 5 - UITextField appears 0,15 User types 0 - UITextField appears 1.50
Here is my problem, when the user types the 4th digit, in my case it is appearing 1,5,00 and not 15,00 as desire.
Follow the formatting code:
NSNumberFormatter *valueTextFieldFormatter= [NSNumberFormatter new];
[valueTextFieldFormatter setPositiveFormat:@"#0,0"];
[valueTextFieldFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
NSString *num = [textField.text stringByReplacingOccurrencesOfString:@"," withString:@""];
textField.text = [valueTextFieldFormatter stringFromNumber:[NSNumber numberWithInt:[num floatValue]]];