UIWebView加载本地页面

Address:http://www.cnblogs.com/haipingwu/archive/2011/03/18/1987968.html

//加载Bundle中的html文件。
NSString *Path = [[NSBundle mainBundle] pathForResource:@"chat.html" ofType:nil];
[WebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:Path]]];

// 执行其中的Javascript
NSString *str = [NSString stringWithFormat:@"addmsg(\"%c%c%c\")", 'A', 'A', 'A'];

NSString
*Value = [WebView stringByEvaluatingJavaScriptFromString:str];
NSLog(
@"%@", Value);


// 加载字符串html代码,并且显示其中的资源文件。
NSString *html =@"<html><body><img src='a.png'></body></html>";
NSString
*path = [[NSBundle mainBundle] bundlePath];
NSURL
*base= [NSURL fileURLWithPath:path];

[WebView loadHTMLString:html baseURL:
base];

原文地址:https://www.cnblogs.com/xingchen/p/2946234.html