答案 0 :(得分:1)
在运行时显示,您使用 NSMutableAttributedString 。 例如
NSDictionary *dicAttributes = @{NSForegroundColorAttributeName:WHITE_COLOR, NSFontAttributeName: UI_DEFAULT_ROBOTO_BOLD(15.0)};
NSMutableAttributedString *string = [[NSMutableAttributedString alloc]initWithString:@"here is your text which want to set" attributes:dicAttributes];
答案 1 :(得分:1)
我得到了你的问题的解决方案。这很容易理解。
NSMutableAttributedString *mutableAttributeStr = [[NSMutableAttributedString alloc]initWithString:@"User this is just a comment.This just a comment.This just a comment."];
NSAttributedString *attributeStr = [[NSAttributedString alloc]initWithString:@"\n" attributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Bold" size:8]}];
[mutableAttributeStr addAttribute:NSFontAttributeName value: [UIFont fontWithName:@"Helvetica-Bold" size:14.0] range:NSMakeRange(0, 4)];
[mutableAttributeStr appendAttributedString:attributeStr];
labelTextBelowAnotherLabel.numberOfLines = 0;
[labelTextBelowAnotherLabel setAttributedText:mutableAttributeStr];
在编码中,我将helvetica设置为粗体和fontsize以供参考。如果要更改为systemBold,只需更改并根据您的要求设置字体大小。
谢谢 - :)
答案 2 :(得分:0)