I have an image that I have in my bundle resources that I need to reference as a source file (src=””) in my webView stringByEvaluatingJavaScriptFromString. I can reference external images from websites, but I do not know how to write the URL of the local image.
How could this be done?
An example to show how you could do this…
in my
viewDidLoad, I am adding some example HTML into a UIWebView as shown below: (This could easily be aloadRequest:call to a remote URL)You need to set the view controller as the delegate for the UIWebView, and wait until it has finished loading the HTML. You can then execute a script to amend the image URL: