什么是NSAttributedString转换相当于<pre> tag?</pre>

时间:2014-09-29 19:32:45

标签: html ios uitextview nsattributedstring pre

我正在解析HTML标签,以便使用NSAttributedStrings在UITextView中进行渲染。

我有点不确定<pre>标记中包含的文字应该如何在UITextView中呈现为属性字符串。

是否应该使用Courier字体格式化,还是<pre>标记还有更多内容?

示例:

This is text
that     is inside of
a pre tag

1 个答案:

答案 0 :(得分:1)

是的,字体应为Courier(或任何其他看似体面的等宽字体)。您可能还需要调整某些空格字符,例如制表符(即将它们转换为空格)。

(为什么不使用UIWebView?)