设置Label部分字体颜色和大小

2017-11-06  本文已影响0人  U_Train_I

NSString *str = [NSString stringWithFormat:@"(推荐) %@",_phoneNumber];

_subtitleLabel.text = str;

NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:_subtitleLabel.text];

[attr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, 4)];

[attr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:10] range:NSMakeRange(0, 4)];

[_subtitleLabel setAttributedText:attr];

上一篇下一篇

猜你喜欢

热点阅读