I want to load an HTML file in an UIWebView using following lines of code:
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"01Numbers" ofType:@"html"];
NSURL *url=[NSURL fileURLWithPath:htmlFile];
NSURLRequest *request=[NSURLRequest requestWithURL:url];
[WebView loadRequest:request];
I am able to load the HTML file, but this HTML file also contain some images, and that images are not loading/visible in the view, can anyone suggest any solution for this?
HTML File:
webView code:
screenshot:
Maybe you should try to put all you local webpage in a folder and use
You can use following way to load HTML file,
In this way all content get converted into Data and will load in webView. (All UI related contents like images icons should be in Resources Dir of project)
I assume the images are also in the bundle. You will have to make sure the path set on the tag is a reference to the location of the image file IN the bundle or wherever you are storing that.