Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local html file load in UIWebview

Tags:

iphone

ipad

I have a local html file in my xcode project. but i can't load that local html file with UIWebView.

like image 726
ram Avatar asked Feb 06 '26 08:02

ram


1 Answers

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];
like image 196
Prasad_R Avatar answered Feb 07 '26 21:02

Prasad_R



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!