代码之家  ›  专栏  ›  技术社区  ›  Matt S.

Cocoa:从字符串显示HTML

  •  2
  • Matt S.  · 技术社区  · 16 年前

    如何显示NSString中格式正确的文本,而NSString恰好是HTML。html来自堆栈溢出API。

    3 回复  |  直到 16 年前
        1
  •  7
  •   zneak    16 年前

    你可以 create a NSAttributedString from HTML . 然后绘制它,就像绘制任何其他nsattributed字符串一样。

        2
  •  1
  •   mbauman    16 年前

    如果您的标记是准确的,并且您正在为OSX(或iPhone4.0+)编程,那么您可以使用NSAttributeString的 – initWithHTML:documentAttributes:

    Three20 库,其中包含 TTStyledText --看起来它可以胜任。

        3
  •  0
  •   Peter Hosey    16 年前

    你可以有一个网络视图,并告诉网络视图的 mainFrame load the HTML string .

    如果你想问可可粉的事, UIWebView has an equivalent method for you