金融app 关于数字的处理

1小数点后面不需要的0去掉,通过float 转NSNumber实现

例如,返回19.980, 显示19.98;返回20.00,显示20;返回15.6;显示15.6


2、 金额千分位显示

3  富文本改变部分文本的颜色和字体大小

UILabel *la = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];

la.font = [UIFont systemFontOfSize:50];

la.textColor=[UIColor redColor];

[self.view addSubview:la];

//富文本

NSRange range = [@"7.5%" rangeOfString:@"%"];

NSMutableAttributedString *attributedStr0 = [[NSMutableAttributedString alloc] initWithString:@"7.5%"];

[attributedStr0 addAttribute: NSFontAttributeName value:[UIFont systemFontOfSize:20] range:range];

la.attributedText = attributedStr0;



你可能感兴趣的:(金融app 关于数字的处理)