Closed zingwin closed 8 years ago
NSMutableAttributedString* contentAttributed = [[NSMutableAttributedString alloc] initWithString:@"default stringas"]; contentAttributed.yy_font = [UIFont systemFontOfSize:16]; contentAttributed.yy_color = [UIColor blackColor]; contentAttributed.yy_alignment = NSTextAlignmentLeft; contentAttributed.yy_lineBreakMode = NSLineBreakByCharWrapping; contentAttributed.yy_backgroundColor = [UIColor yellowColor];
yyLabel.attributedText = contentAttributed;
yy_backgroundColor 只能用于 UILabel/UITextView,这个属性的注释上有标注。 背景色可以用 yy_textBackgroundBorder 来设置。
谢谢。
yyLabel.attributedText = contentAttributed;