iOS label显示富文本
作者:
小码农CC | 来源:发表于
2020-06-22 15:15 被阅读0次NSString * htmlString = @" Some html string \nThis is some text!";
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
UILabel * myLabel = [[UILabel alloc] initWithFrame:self.view.bounds];
myLabel.attributedText = attrStr;
[self.view addSubview:myLabel];
本文标题:iOS label显示富文本
本文链接:https://www.haomeiwen.com/subject/ilgxfktx.html
网友评论