在tableview中使用后特别卡
NSString *htmlString=[NSString stringWithFormat:@"<html><body>%@</body></html>", doc.summary];
NSMutableAttributedString * attrStr = [[NSMutableAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
[attrStr addAttribute:NSForegroundColorAttributeName value:[UIColor darkGrayColor] range:NSMakeRange(0, attrStr.length)];
cell.abslabel.attributedText = attrStr;
NSMutableAttributedString * attrStr = [[NSMutableAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
[attrStr addAttribute:NSForegroundColorAttributeName value:[UIColor darkGrayColor] range:NSMakeRange(0, attrStr.length)];
cell.abslabel.attributedText = attrStr;
本文介绍了一种在TableView中高效展示HTML文本的方法。通过将HTML字符串转换为NSAttributedString,并设置文本颜色,使得文本呈现更加流畅,解决了加载缓慢的问题。
3306

被折叠的 条评论
为什么被折叠?



