无法在 UIWebView 中显示 iPhone SDK 资源文件夹中的图像

发布于 2024-10-10 05:21:51 字数 898 浏览 0 评论 0原文

在我的项目中,我想在 web 视图中显示资源文件中的图像,

我将该内容放置在 html 页面中并在 web 视图中显示。 在我的正文内容中有一些图像,它采用这样的网址 问题是图像没有在 web 视图中显示,只有问号图像在 web 视图中显示?

这是我为此

NSURL *resourcePathURL = [[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] resourcePath] isDirectory:YES]

[self.webView loadHTMLString:contentString baseURL:resourcePathURL];

[resourcePathURL release];

编写的代码我正在使用这样的图像名称“Asparagus-with-Shallots.png” 我对每个图像采取不同的尺寸 120*150,130*230 像这样 '$''$'

        '$'<p><img src=”Tiramisu.png”/><br>a computer file consisting solely '$' 

'$' 来自可识别字符集的可打印字符。

4 份

奶油“$”“$”填充
1 杯马斯卡彭奶酪(8 盎司)
1 个仅包含“$”的计算机文件 来自可识别字符集的“$”可打印字符!

对于糖浆:'$' '$' '$'

我正在附加图像,我得到的图像显示就像从资源文件夹中获取的图像

“替代文本”

谢谢

In my project i want to display the Images in resources file in the webview

i am placing that content in html page and showing in web view.
in my body content having some images it is taking url like this
the problem is the image is not displaying in webview only question mark image is displaying in webview?

this is the code i written for this

NSURL *resourcePathURL = [[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] resourcePath] isDirectory:YES];

[self.webView loadHTMLString:contentString baseURL:resourcePathURL];

[resourcePathURL release];

i am taking image names like this "Asparagus-with-Shallots.png"
i am taking different dimenssion to each images 120*150,130*230 like this
'$''$'

        '

'$' of printable characters from a recognized character set.

4 servings

Cream'$' '$'Filling
1 cup mascarpone cheese (8 ounces)
1 a computer file consisting solely'$'
'$'of printable characters from a recognized character set!

For the syrup:'$'
'$'
'$'

I am attaching a image, I am getting the image displaying like in image getting from resource folder

alt text

Thanks

<p><img src=”Tiramisu.png”/><br>a computer file consisting solely '

'$' of printable characters from a recognized character set.

4 servings

Cream'$' '$'Filling
1 cup mascarpone cheese (8 ounces)
1 a computer file consisting solely'$'
'$'of printable characters from a recognized character set!

For the syrup:'$'
'$'
'$'

I am attaching a image, I am getting the image displaying like in image getting from resource folder

alt text

Thanks

'$' of printable characters from a recognized character set.

4 servings

Cream'$' '$'Filling
1 cup mascarpone cheese (8 ounces)
1 a computer file consisting solely'$'
'$'of printable characters from a recognized character set!

For the syrup:'$'
'$'
'$'

I am attaching a image, I am getting the image displaying like in image getting from resource folder

alt text

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡笑忘祈一世凡恋 2024-10-17 05:21:51

只需浏览这篇文章: iPhone Dev :UIWebView baseUrl 到文档文件夹中的资源而不是应用程序包。看来你的问题在这里得到了解答。

Just go through this post: iPhone Dev: UIWebView baseUrl to resources in Documents folder not App bundle. Looks like your question is answered here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文