无法在 UIWebView 中显示 iPhone SDK 资源文件夹中的图像
在我的项目中,我想在 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
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
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
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需浏览这篇文章: 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.