1,loadRequest:
加载网络资源:
[webView loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:urlStr]]];
这个地址是网络地址,或者网络地址拼接自己的地址,如:
NSString* urlStr = @"http://bestpay.ctdns.net/u1/mepf/mems/html/agreement/" ;
urlStr = [urlStr stringByAppendingPathComponent : AgentForSettlement.html] ;
2,loadHTMLString:
加载本地的html文件
[webView loadHTMLString : [[NSBundle mainBundle] pathForResource:@" AgentForSettlement " ofType:@"html"]; baseURL : [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];
安全一点把string进行UTF8转码一下
NSString *html = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];