设置一个字符串中的个别字符的特殊格式
颜色大小的特殊处理
NSDictionary *consumDic = @{NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:[UIColor colorWithRed:255 green:255 blue:255 alpha:1.0]};
NSDictionary *moneySignDic = @{NSFontAttributeName:[UIFont systemFontOfSize:12], NSForegroundColorAttributeName:[UIColor colorWithRed:255 green:255 blue:255 alpha:1.0]};
NSMutableAttributedString *mAttrString = [[NSMutableAttributedString alloc] initWithString:@"消费¥0.00/余额0.00" attributes:consumDic];
[mAttrString addAttributes:moneySignDic range:NSMakeRange(2, 1)];
[mAttrString addAttributes:moneySignDic range:NSMakeRange(8, 6)];
NSDictionary *moneySignDic = @{NSFontAttributeName:[UIFont systemFontOfSize:12], NSForegroundColorAttributeName:[UIColor colorWithRed:255 green:255 blue:255 alpha:1.0]};
NSMutableAttributedString *mAttrString = [[NSMutableAttributedString alloc] initWithString:@"消费¥0.00/余额0.00" attributes:consumDic];
[mAttrString addAttributes:moneySignDic range:NSMakeRange(2, 1)];
[mAttrString addAttributes:moneySignDic range:NSMakeRange(8, 6)];
consumLabel.attributedText = mAttrString;
posted on 2015-12-04 17:29 taiyang2014 阅读(219) 评论(0) 编辑 收藏 举报