Reputation: 1193
I have a local html file in my xcode project. but i can't load that local html file with UIWebView.
Upvotes: 2
Views: 5191
Reputation: 557
The code to achieve your request is:
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];
Upvotes: 9