用于舍入浮点值的NSNumberFormatter

los*_*sit 2 cocoa-touch

我有一个CGFloat值,我希望在小数点后舍入到3位数.我该怎么做?

谢谢.

Zac*_*ley 10

NSString *value = [NSString stringWithFormat:@"%.3f", theFloat];
Run Code Online (Sandbox Code Playgroud)