图文混编

NSString *textStr = [NSString stringWithFormat:@"总积分(分):%.2f", a];

NSMutableAttributedString *label1Str = [[NSMutableAttributedString alloc]initWithString:textStr];

[label1Str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(7, label1Str.length-7)];

self.label1.attributedText = label1Str;

你可能感兴趣的:(图文混编)