My setup:
I have a webview in my iPhone app, going to http://www.mysite.com.
Trials
If I set “backgroundcolor uicolor clearcolor” to my webview and draw an uiimage behind my webview, it won’t scroll with my webview!
My problem:
I would like the image to with the webview. Also, this image should be stored in the iPhone app and not on the webserver (Of course, if I put the image on the webserver I can simply draw it as background with CSS).
What is the best way to access this image via html/javascript/Objective C, so I can see this local image as background of my website? Is there a way at all?
You have a couple of options. You can load the page with a baseURL of
or you can use javascript to set the path to your image using the following method.
Edit: Check here Link to resources inside WebView – iPhone. It looks like you will use pathForResource rather than URLForResource.
Edit 2: You may want to use Data URI’s to add your own local files to the web site.
YourCode.m
The following code I DID NOT WRITE and I am not sure of the origin
NSData+Base64.h
NSData.Base64.m
NSString+DataURI.h
NSString+DataURI.m