2016.8.31
//小数四舍五入
// 如: 100.178 = 100.18 | 100.123 = 100.12
- (NSString*)roundingOffwithFormat:(NSString*)format floatNum:(float)num {
NSNumberFormatter*numberFormatter = [[NSNumberFormatteralloc]init];
[numberFormattersetPositiveFormat:format];
return[numberFormatterstringFromNumber:[NSNumbernumberWithFloat:num]];
}
// 保留小数 如果0.00改成%.2f 结果就会错
self.backMoneyLab.text= [selfroundingOffwithFormat:@"0.00"floatNum:backMoney];