我想在中显示带有<blockquote>标签的HTML文本UITextView.
HTML的例子:
<div>
<blockquote class="uncited">
<div>
<cite>Nick:</cite>
<blockquote class="uncited">
<div>
<cite>Tom:</cite>censored<br>
Hello
</div>
</blockquote>
<p>World</p>
</div>
</blockquote>
<p>Text</p>
</div>
Run Code Online (Sandbox Code Playgroud)
我使用以下代码在单元格中显示HTML文本:
UITextView *textView = (UITextView*)[cell viewWithTag:100];
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:[thisComment.htmlText dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
textView.attributedText = attributedString;
Run Code Online (Sandbox Code Playgroud)
但UITextView它看起来像纯文本.我想得到它:样本
我该怎么做?我应该使用什么样的库?我想想HTML -> Markdown -> NSAttributedString -> TextView