我的xcode项目中有一个本地html文件。但是我无法用UIWebView加载那个本地html文件。
答案 0 :(得分:9)
实现您的请求的代码是:
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];
答案 1 :(得分:1)