-1

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 static files like css's and images from the local resource folder of my app....

can i do this?

my html is something like this:

<html> <body> 
<img
src="file://Resources/test.png">
</body> </html>
costamatrix
  • 670
  • 8
  • 17

1 Answers1

0

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>
Philippe Leybaert
  • 168,566
  • 31
  • 210
  • 223
  • but that way, i will have an static html too... understand that i need to keep using a remote dinamic html (from a php).... i just want to use images from local resource....something like this: http://teste.com/testepage.php and that page requesting a local files .... can i do this? – costamatrix Feb 20 '10 at 16:07