views:

254

answers:

2

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>
+1  A: 

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
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.phpand that page requesting a local files ....can i do this?
costamatrix
no body ????????????????
costamatrix
A: 

No folks, let me ask again....

the point is... i have a dynamic html from php...ant it has to be dynamic...this html uses jquery library, i was wondering if i can have the jquery.js on my bundle (app), and make these dynamic html to use the local jquery.js, but everything else from the web (images...etc)...

Rodrigo