iOS-UILabel同一个Label 不同字体颜色
前言
如图
- (UILabel *)tipsLabel {
if(_tipsLabel == nil) {
_tipsLabel = [[UILabel alloc]init];
_tipsLabel.font = [UIFont systemFontOfSize:HNWidth(14)];
_tipsLabel.textAlignment = NSTextAlignmentLeft;
_tipsLabel.textColor = HN_Color_Hex(#18F8F5);
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"kBaseVideoCallViewOpengirlturned", nil)];
NSRange range2 = [[str string] rangeOfString:NSLocalizedString(@"kBaseVideoCallViewOpengirl", nil)];
[str addAttribute:NSForegroundColorAttributeName value:HN_Color_Hex(#FCD126) range:range2];
_tipsLabel.attributedText = str;
}
return _tipsLabel;
}