利用属性字符串修改字体大小 颜色
2018-04-26 本文已影响9人
沃伦盖茨
NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc] initWithString:label.text];
[AttributedStr addAttribute:NSForegroundColorAttributeName
value:[HuConfigration uiColorFromString:@"#D3D3D3"]
range:NSMakeRange(0, 4)];
[AttributedStr addAttribute:NSFontAttributeName
value:[UIFont customFontSize:18]
range:NSMakeRange(0 , 4)];//0开始,长度是4