1、转换为NSMutableAttributedString
NSMutableAttributedString *htmlStr = [[NSMutableAttributedString alloc] initWithData:[@"字符串" dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil];
// 字体大小
[htmlStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15] range:NSMakeRange(0, htmlStr.length)];
2、接收转换后的内容
_lab.attributedText = htmlStr;
网友评论