1. 程式人生 > >設定label不同顏色

設定label不同顏色

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

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

    [textColor addAttribute:NSForegroundColorAttributeNamevalue:UIColorFromHex

(0xf0d99b) range:rangel];

    [textColor addAttribute:NSFontAttributeNamevalue:[UIFontsystemFontOfSize:APPDELEGATE.isPad?20:15] range:rangel];

    [photoSettingLabel setAttributedText:textColor];