美文网首页
利用属性字符串修改字体大小 颜色

利用属性字符串修改字体大小 颜色

作者: 沃伦盖茨 | 来源:发表于2018-04-26 10:52 被阅读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

相关文章

网友评论

      本文标题:利用属性字符串修改字体大小 颜色

      本文链接:https://www.haomeiwen.com/subject/aooqlftx.html