CGFloat f = 123.1234567890; NSString *str=[NSString stringWithFormat:@”%.2f”, f]; 如上所述:字符串格式化,格式出输入%.2f ,及表示两位小数orm
若是取后3位即 %.3f 后4位即 %.4f字符串