如何将HTML插入UIWebView [英] How to insert HTML into a UIWebView
本文介绍了如何将HTML插入UIWebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有 HTML 内容,它显示在 UITextView
中。我的应用程序的下一次迭代是将 HTML 内容显示到 UIWebView
中。所以,我基本上用 UIWebView
替换了我的 UITextView
。但是,我无法弄清楚如何将 HTML 代码段插入视图中。它似乎需要一个我不想要的 URLRequest
。我已经将 HTML 内容存储在内存中,并希望从内存加载并显示它。
I have HTML Content which was being displayed in a UITextView
. The next iteration of my app is display the HTML contents into a UIWebView
. So, I basically replaced my UITextView
with UIWebView
. However I could not figure out how to insert my HTML snippet into the view. It seems to need a URLRequest
which I do not want. I have already stored the HTML content in memory and want to load and display it from memory.
我应该如何处理?
推荐答案
这应该可以解决问题:
NSString *myHTML = @"<html><body><h1>Hello, world!</h1></body></html>";
[myUIWebView loadHTMLString:myHTML baseURL:nil];
这篇关于如何将HTML插入UIWebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文