Home >Web Front-end >HTML Tutorial >UIWebView加载本地html文件_html/css_WEB-ITnose

UIWebView加载本地html文件_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 11:17:541214browse

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight-64)];        webView.backgroundColor=YYCToothWashViewBgColor;        [self.view addSubview:webView];        //加载本地html文件    NSString *path = [[NSBundle mainBundle] bundlePath];    NSURL *baseURL = [NSURL fileURLWithPath:path];        //protocal   html文件名称    html文件类型    NSString * htmlPath = [[NSBundle mainBundle] pathForResource:@"protocal"                                                          ofType:@"html"];    NSString * htmlCont = [NSString stringWithContentsOfFile:htmlPath                                                    encoding:NSUTF8StringEncoding                                                       error:nil];    [webView loadHTMLString:htmlCont baseURL:baseURL];

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn