Reputation: 44352
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?
Upvotes: 3
Views: 2471
Reputation: 46051
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.
Upvotes: 5
Reputation: 243
Is there a reason you're not using UIImageView
instead to display this image?
Upvotes: 0