UILabel *infoLabel = [[UILabel alloc]initWithFrame:CGRectMake(95, 20, 190, 70)];
infoLabel.backgroundColor = [UIColor clearColor];
infoLabel.textAlignment = NSTextAlignmentLeft;
infoLabel.font = [UIFont systemFontOfSize:13];
infoLabel.numberOfLines = 0;
infoLabel.textColor = KSignTextColor;
NSString *infoString = @"连续签到1天得10积分;\n连续签到2天得15积分;\n连续签到3天及以上得20积分;\n注:若连续签到终端则重新计算";
NSRange infoRange = [infoString rangeOfString:@"注:"];
NSMutableAttributedString *infoATString = [[NSMutableAttributedString alloc]initWithString:infoString ];
[infoATString addAttribute:(NSString *)NSForegroundColorAttributeName
value:(id)[UIColor redColor].CGColor
range:infoRange];
// NSRange range = NSMakeRange(infoString.length-1, 1);
//[infoATString addAttribute:(NSString *)kCTFontAttributeName value:(id)[UIFont systemFontOfSize:10] range:range];
[infoLabel setAttributedText:infoATString];
NSMutableAttributedString 设置不同颜色,不同字体的String,布布扣,bubuko.com
NSMutableAttributedString 设置不同颜色,不同字体的String
原文地址:http://www.cnblogs.com/zhujin/p/3848420.html