首页 > Web开发 > 详细

UIWebView加载本地html文件

时间:2016-05-18 10:19:20      阅读:181      评论:0      收藏:0      [点我收藏+]
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];

 

UIWebView加载本地html文件

原文:http://www.cnblogs.com/fengmin/p/5504010.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!