UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(100, 10, 200, 100)];  
int i=arc4random()%100;  
NSString *str1=@"本期参与:";  
NSString *str2=[NSString stringWithFormat:@"%d",i];  
NSString *str3=@"人次";  
NSString *contentStr=[NSString stringWithFormat:@"%@%@%@",str1,str2,str3];  
NSMutableAttributedString *str = [[NSMutableAttributedString alloc]initWithString:contentStr];  
[str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(5,str2.length )];  
[str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:25] range:NSMakeRange(0, str2.length)];  
label.attributedText = str;  
[self.view addSubview:label];  

运行结果

blog_20170220001