UIWebView无法找到本地图像

时间:2014-09-24 08:12:01

标签: ios uiwebview

NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
NSURL *baseURL = [NSURL fileURLWithPath:htmlFile];
NSString *htmlString = [NSString stringWithContentsOfFile:htmlFile
                                                 encoding:NSUTF8StringEncoding
                                                    error:nil];
myWebView = [[UIWebView alloc] init];
[myWebView loadHTMLString:htmlString baseURL:baseURL];

我的代码是这样的。在index.html中,我有

<img src="dog.gif"/>
<h1>index.html loaded</h1>

index.html和dog.gif都存储在PROJECT_ROOT / Resources /中。 但我的应用程序在模拟器上运行正常,但无法在我的iPad上加载dog.gif。文本显示在两者上。我清理了项目,但那没有用。

0 个答案:

没有答案