设置一个字符串中的个别字符的特殊格式

  颜色大小的特殊处理
 
    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)];
    consumLabel.attributedText = mAttrString;
原文地址:https://www.cnblogs.com/tian-sun/p/5020027.html