再会。
我有一个 UIWebView
,它加载一篇包含 10 多个图像的大文章。 HTML代码存储在本地,图像由UIWebView
自动加载。
有时,Web 视图不会加载所有图像(例如,10 张中的 3 张)。它不依赖于连接类型(EDGE/WiFI)
、图像数量(有时网页视图加载 20 张图像中的 20 张,有时不加载 5 张图像中的 3 张)。
据我了解,目前解决此问题的唯一方法是解析 HTML 中的
标签,并以编程方式将图像加载到本地缓存以供将来显示。
有什么想法吗?有什么方法可以控制 UIWebView 的图像加载吗?
谢谢。
Good day.
I have a UIWebView
that loads a big article with 10+ images. HTML code is stored locally, images are loaded by UIWebView
automatically.
Sometimes web view won't load all of the images (for example, 3 out of 10). It doesn't depend on a connection type (EDGE/WiFI)
, image amount (sometimes web view loads 20 out of 20 images, sometimes doesn't load 3 out of 5).
As for now the only way to fix this as I understand is parsing <img>
tags in HTML and loading images programmatically to a local cache for future displaying.
Any thoughts? Is there any way to control UIWebView's
image loading?
Thank you.
发布评论
评论(1)
我最近在另一个项目中遇到了同样的问题:一些图像仅在 GPRS/EDGE 等慢速连接上显示为半黑。原因是我客户的网络服务器在下载图像时有连接时间限制。如果您遇到类似的问题,请不要忘记检查。
I've recently had the same issue on another project: some images were displaying as half black only on slow connections like GPRS/EDGE. The reason was that my client's web server had a limit for connection time when downloading images. If you've run into similar issue don't forget to check that.