1.加载网络url
使用:
NSURL * url = [NSURL URLWithString:@”http://blog.csdn.net/crazyengineer_xin“];
[self.myWebVIew loadRequest:[NSURLRequest requestWithURL:url]];
2.加载本地页面
NSString *htmlPath = [[[NSBundle mainBundle]
bundlePath]
stringByAppendingPathComponent:@”index.html”];
[self.MyWebview loadRequest:[NSURLRequest
requestWithURL:[NSURL fileURLWithPath:htmlPath]]];
3.加载一段HTML代码
NSString *htmlPath = [[[NSBundle mainBundle] bundlePath]
stringByAppendingPathComponent:@”index.html”];
NSString *htmlString = [NSString stringWithContentsOfFile: htmlPath
encoding:NSUTF8StringEncoding error:NULL];
[self.MyWebview loadHTMLString:htmlString baseURL:[NSURL
fileURLWithPath:htmlPath]];