3

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?

4

2 回答 2

5

尝试改变

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

到一个

[NSURL fileURLWithPath:path]

路径类似于

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

...取决于图像的放置位置。

于 2009-06-27T22:47:09.933 回答
0

您是否有理由不使用UIImageView来显示此图像?

于 2009-06-27T19:15:40.673 回答