OC 格式化数据

 1 //        NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
 2 //        [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
 3 //        
 4 //        NSString *temp = [NSString stringWithFormat:@"%.2f",val];
 5 //        double fort = [[numberFormatter numberFromString:temp] doubleValue];
 6 
 7  8 
 9 
10 NSNumberFormatter *pFormatter = [[NSNumberFormatter alloc] init];
11     pFormatter.numberStyle = NSNumberFormatterPercentStyle;
12     pFormatter.maximumFractionDigits = 1;
13     pFormatter.multiplier = @1.f;
14     pFormatter.percentSymbol = @" %";
15     [data_pie setValueFormatter:pFormatter];
16     [data_pie setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:11.f]];
17     [data_pie setValueTextColor:UIColor.whiteColor];
18     
19     _guben_pie_ChartView.data = data_pie;
20     [_guben_pie_ChartView highlightValues:0];

 

posted @ 2016-06-06 16:16  超级马力  阅读(292)  评论(0编辑  收藏  举报