您的位置:首页 > Web前端 > HTML

加载本地HTML文件

2015-12-30 11:23 579 查看
UIWebView*webView = [[UIWebView alloc] initWithFrame:self.view.frame];
NSString*path = [[NSBundle mainBundle] bundlePath];
NSURL*url = [NSURL fileURLWithPath:path];
/*NSString*htmlPath = [[NSBundle mainBundle] pathForResource:@"code.txt" ofType:nil];*/
NSString*htmlPath = [[NSBundle mainBundle] pathForResource:@"help.html" ofType:nil];
NSString*htmlCont = [NSString stringWithContentsOfFile:htmlPath encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:htmlCont baseURL:url];
[self.view addSubview:webView];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: