如何让一个lable展示不同的文字风格
NSString *str_one =[NSString stringWithFormat:@"当前成功扫描%lu箱瓶盖",(unsigned long)a ]; NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:str_one]; [str addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0,6)]; [str addAttribute:NSForegroundColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(6, [[str string] rangeOfString:str_one].length - 9)]; [str addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange([[str string]rangeOfString:str_one].length -3 , 3)]; [str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:25.0] range:NSMakeRange(0, 6)]; [str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:30.0] range:NSMakeRange(6, [[str string] rangeOfString:str_one].length - 9)]; [str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:25.0] range:NSMakeRange([[str string]rangeOfString:str_one].length -3 , 3)]; _lab_buttom.attributedText = str ;