I think your format may be wrong. What result do you expect and what do you get?
If I guessed correctly, you can try the following:
label.text = [NSString stringWithFormat:@"%5.2f", answer];
where 5 means total digits (in terms of padding for alignment), and 2 means 2 decimal places.
EDIT: Avoid memory leak as pointed out in donkim comment!
source
share