I am putting the finishing touches on开发者_Python百科 my app and for some reason the values are not being shown as a decimal value.
if ( row == 0 ) {
float number1 = ([initamount.text floatValue ]);
initamount.text = [[NSString alloc]initWithFormat:@"%2.f Yard", number1];
double answer = number1 *3;
result.text = [[NSString alloc]initWithFormat:@"%2.f Feet", answer];
}
here is the code i am really tired and could be missing something.
Correct format string should be (note that desired precision should come after '.' in format specifier)
@"%.2f Yard"
精彩评论