NSString *newValue = [NSString stringWithFormat:@"%0.1f", [textField.text floatValue]];
the number after the dot is the number of decimal places you want.
UPDATE: You can use string manipulation to determine the number of decimal places the user entered (remember to check for cases of edges):
NSInteger numberOfDecimalPlaces = textString.length - [textString rangeOfString:@"."].location - 1;
and then, if you want to create a new line with a new float with the same level of display accuracy, you can use:
NSString *stringFormat = [NSString stringWithFormat:@"%%0.%if", numberOfDecimalPlaces]; NSString *newString = [NSString stringWithFormat:stringFormat, newFloat];
source share