设置label不同颜色

 

 NSMutableAttributedString *textColor = [[NSMutableAttributedString alloc]initWithString:photoSettingLabel.text];

    NSRange rangel = [[textColor string] rangeOfString:[photoSettingLabel.text substringWithRange:NSMakeRange(18, 12)]];

    [textColor addAttribute:NSForegroundColorAttributeName value:UIColorFromHex(0xf0d99b) range:rangel];

    [textColor addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:APPDELEGATE.isPad?20:15] range:rangel];

    

    [photoSettingLabel setAttributedText:textColor];

你可能感兴趣的:(设置label不同颜色)