UIWebView的使用小結

weixin_33976072發表於2015-10-20

方法一:

// 訪問本地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];

相關文章