views:

712

answers:

2

I'd like to dislay an image in UIWebView using

<img src="imageInBundle.png"/>

The above image is in my bundle. I load it, along with other HTML in a string, like this:

[myWebView loadHTMLString:htmlString baseURL:[NSURL URLWithString: @"http://www.abc.com"]];

However, I just get a blue box with a white question mark. Is there something else I need to do?

A: 

Is there a reason you're not using UIImageView instead to display this image?

Eric de Araujo
How do you dynamically execute a UIImageView embedded in string? Not that I'd really want to.
4thSpace
+2  A: 

Try to change the

[NSURL URLWithString: @"http://www.abc.com"]

to a

[NSURL fileURLWithPath:path]

where path is something like

NSString *path = [[NSBundle mainBundle] bundlePath];

...depending where the image is placed.

epatel