loadHTMLString:baseURL是什么:

use*_*871 6 iphone xcode uiwebview

我是iOS编程的新手,并试图找出loadHTMLString:baseURL:真正的功能,但我找不到令人满意的解释.Apple的网站只是说:

设置主页面内容和基本URL.

有人可以通过更详细的方式向我解释一下吗?

Sri*_*aju 3

这就是在 webView 中加载内容的主要方式。来自本地 html 文件或通过 url。

//this is to load local html file. Read the file & give the file contents to webview.
[webView loadHTMLString:someHTMLstring baseURL:[NSURL URLWithString:@""]]; 

//if webview loads content through a url then 
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]]]
Run Code Online (Sandbox Code Playgroud)