UIWebView的使用小结

方法一:

// 访问本地html

NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"home_page" ofType:@"html"];

NSString *htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];

//    self.webView.scrollView.scrollEnabled = NO;

[self.webView loadHTMLString:htmlString baseURL:[NSURL URLWithString:htmlFile]];

方法二:

// 访问本地html

NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"home_page" ofType:@"html"];

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:htmlFile]];

[self.webView loadRequest:request];

你可能感兴趣的:(UIWebView的使用小结)