【发布时间】:2011-12-23 03:52:18
【问题描述】:
我在 UIWebView 中显示一个 html 页面,如下所示:
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"index" ofType:@"html"]isDirectory:NO]]];
html 包含对图像的引用:
<img src="ScreenshotTop.jpg" alt="Screenshot Top Part" />
我根本无法显示 JPG(即使按照其他一些问题/答案的建议设置 baseURL)。但是,当我将图形的格式更改为 PNG 并像这样引用该文件时:
<img src="ScreenshotTop.png" alt="Screenshot Top Part" />
一切正常。这是否意味着 UIWebView 可以正确显示 PNG,但不能与 JPG 一起使用?还是有其他事情发生?
(FWIW,我使用的是 XCode 4.1 和 iOS 模拟器 4.3.2。)
【问题讨论】: