0

我正在执行将 rtf 文件更改为 html 文件的任务。但是,如何将 .html 文件读取到 NSTextView 或其他对象。我测试以下 API 在读取 HTML 文件时效果很好。

NSTextView *showHtml;

[showHtml readRTFDFromFile:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"html"]];

对象 showHtml 可以像浏览一样显示 Html 文件。

但是像这样的 API readRTFDFromFile 描述只能读取 rtf 或 rtfd 文件。

是否有任何 API 或方法可以在 xib 中显示 Html 文件。

我还测试了 API:

[[NSAttributedString alloc] initWithHTML:(NSData *) data documentAttributes:(NSDictionary **) docAttributes],
setAttributedStringValue:(NSAttributedString *) aAttributeString 

但它不能显示除字符串之外的属性。

感谢您的回复。

4

0 回答 0