NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:string];
//设置颜色
[str addAttribute:NSForegroundColorAttributeName
value:[UIColor blueColor]
range:NSMakeRange(0,5)];
[str addAttribute:NSForegroundColorAttributeName
value:[UIColor redColor]
range:NSMakeRange(6,12)];
[str addAttribute:NSForegroundColorAttributeName
value:[UIColor greenColor]
range:NSMakeRange(19,6)];
//设置字体
[str addAttribute:NSFontAttributeName
value:[UIFont fontWithName:@"Arial" size:30.0]
range:NSMakeRange(0, 5)];
[str addAttribute:NSFontAttributeName
value:[UIFont fontWithName:@"Arial" size:30.0]
range:NSMakeRange(6, 12)];
[str addAttribute:NSFontAttributeName
value:[UIFont fontWithName:@"Arial" size:30.0]
range:NSMakeRange(19, 6)];
label.attributedText = str;