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

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

WBOY
Release: 2016-06-24 11:17:54
Original
1158 people have browsed it

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];
Copy after login

 

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template