【发布时间】:2011-06-15 12:18:54
【问题描述】:
我的 xcode 项目中有一个本地 html 文件。但我无法使用 UIWebView 加载该本地 html 文件。
【问题讨论】:
我的 xcode 项目中有一个本地 html 文件。但我无法使用 UIWebView 加载该本地 html 文件。
【问题讨论】:
实现您的要求的代码是:
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0,
self.view.frame.size.height,self.view.frame.size.width)];
NSString *indexPath = [NSBundle pathForResource:@"index" ofType:@"html" inDirectory:nil];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:indexPath]]];
[self.view addSubview:webView];
【讨论】: