How to get rid from question mark in a blue square in UIWebView?

你说的曾经没有我的故事 提交于 2020-02-08 03:19:09

问题


In my iPhone application I'm parsing RSS feed to get html and keep it. Afterwards I display this html in UIWebView. The problem is that html contains urls of images, if there is network connection everything is ok, UIWebView loads and displays these images, but if there is no connection it shows text but in place of images shows frame with blue square inside

How can I get rid of it? Thank you


回答1:


Check programmatically to make sure that you have an internet connection.

See this question and its accepted answer on how to do that.

If you don't have an internet connection, then you have a couple of options. You can either:

  1. Parse through your html, replace the <img> tags with blanks (this will completely get rid of the images and their associated blue question mark boxes.
  2. Parse through your html, replace the src part of <img src="somewebsite"> with a reference to an image placeholder in the project bundle.

XPath is your friend when it comes to parsing html. Although if you wanted to, you could do all of this with NSSTring.



来源:https://stackoverflow.com/questions/3907928/how-to-get-rid-from-question-mark-in-a-blue-square-in-uiwebview

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!