开发者

Images missing in iOS 4.2 on iPad

I'm developing an iPad app using iOS4.3. It uses a UIWebView and javascript (some jQuery) to do change some images and HTML. It's working fine in the simulator and on the iPad, but I want to deploy on iOS 4.2 as well, so I tried it in the simulator and found that some of the images don't change. For example;

$('#sideImage').attr("src","sun.png");

does not load the image sun.png. I've tried it without jQuery (using document.getElementById), by changing innerHTML instead of the src and by preloading the images, but none are working in 4.2. I have about a dozen images this happens to, and the poster image of a video tag.

I've checked that the images are in the "copy bundle resources" for the target in xCode.

I don't have an iPad with 4.2 to check on a device, so I thought it might be an xCode b开发者_JS百科ug. I was using 4.0, but I've upgraded to 4.2 today and the problem is still there.

Any ideas?


Have you checked the case? iOS uses a case-sensitive filesystem, so if you refer to sun.png and the file is actually called Sun.png, then it will work fine in the simulator (on a case-insensitive filesystem), but fail on a real device.


I don't remember the details, but I had a similar problem that I fixed by constructing a complete URL for the image (including the path to the resource directory). It seemed that the image wasn't in whatever the UIWebView considered to be its root directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜