ram
ram

Reputation: 1193

Local html file load in UIWebview

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

Answers (2)

Android
Android

Reputation: 9023

try this may it be useful to you happy coding :) 1 2 3

Upvotes: 1

Prasad_R
Prasad_R

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

Related Questions