How To Use An IPhone WebView With An External HTML That References Local Images?
Hi i have an external html on my webserver, that is requested by my iphone app through a webview... in order to make the page load faster, i want to change my html to request stati
Solution 1:
You can set the baseURL for UIWebView to the resource path of your main bundle:
NSURL *baseURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
[webView loadHTMLString:htmlString baseURL:baseURL];
Then you can simply refer to your images like this:
<html> <body>
<img src="test.png" />
</body> </html>
Post a Comment for "How To Use An IPhone WebView With An External HTML That References Local Images?"