Open mythkiven opened 4 years ago
code:
NSMutableAttributedString *attString = [NSMutableAttributedString new];
UIFont *font = [UIFont systemFontOfSize:16];
NSString *string = @"ޙޓゝ₯";
[attString appendAttributedString:[[NSAttributedString alloc] initWithString:string attributes:nil]];
attString.yy_font = font;
YYLabel * yylabel = [YYLabel new];
yylabel.textVerticalAlignment = YYTextVerticalAlignmentTop;
yylabel.textAlignment = NSTextAlignmentLeft;
yylabel.backgroundColor = [UIColor cyanColor];
yylabel.frame = CGRectMake(100, 200, 210, 30);
yylabel.attributedText = attString;
[self.view addSubview:yylabel];
代码与效果,见图片: