使用某个div类的html动态填充uiwebview?

时间:2012-10-22 23:03:06

标签: iphone html objective-c ios uiwebview

取决于我访问的博客文章,我需要使用一个div类的html来填充uiwebview。它每次都是相同的div类html,名称不会改变,只是内容。

调用div类:

<div class="field-item even" property="content:encoded">

内容如下:

    <div class="field-items"><div class="field-item even" property="content:encoded"><p>Data centre security is a big issue – especially for co-location centres hosting multiple racks for multiple, often competing, clients. Yet whilst security to access the data centre can often be impressive, individual rack level security is often inadequate. Given the number of in-house staff and external engineers, from cablers to storage and server providers, traipsing through a data centre on a near daily basis, poor rack level security is a potential risk.</p>
<p>According to a recent survey conducted by Lieberman Software, 42 percent of IT staff can get unauthorised access to their organisation’s most sensitive information – including the CEO’s private documents. The failing is blamed on management’s naivety when it comes to understanding just how much privileged access their IT departments actually have.</p>
<p>The fact that most racks are secured only with standard handles using a manual key, bears out this survey. Easily broken or bypassed, these locks provide minimal corporate protection; they offer no access control or audit trail of activity. Given the huge ongoing investment in data centres - during 2011-2012, the UK invested an estimated $3.35 billion in data centres; the second highest spending of any country, according to the Datacentre Dynamics Global Industry Census 2011 - extending standard access control techniques to the data centre racks is an important step.</p>
<p>Companies can opt for a rack specific key, combination locks or key cards that are IP enabled to allow an organisation to impose strict control over the time/day an individual is allowed to access the rack. Using standard access control software, all activity is recorded and audited, providing the organisation with a complete list of those who have accessed the racks.</p>
<p>For organisations, this approach adds control and addresses one important aspect of the internal threat. For co-location sites, rack level security removes the need to cage off client specific rack space areas freeing up space that can be used for more racks, delivering a return on investment, as well as improved client security.</p>
</div>

可以找到页面here

我需要一种方法来从页面网址中获取该div中的html,保留样式并将其放入字符串然后填充uiwebview,任何人都可以帮助我吗?

感谢。

更好的代码方案:

基本上我从博客文章的RSS源中填充了一个非常合适的视图。这工作正常。点击博客文章,返回点击的博客文章的URL作为要使用的字符串。它来自这里,我不明白如何将此字符串加载到webview中,然后在该Web视图上使用jquery仅显示该一个div类中的所有内容(如上所述。)

1 个答案:

答案 0 :(得分:0)

您可以将页面上的所有内容加载到webview中,然后运行一些javascript来隐藏除div和其内容之外的所有内容。这个stackoverflow question(嗯,实际上,答案)看起来会帮助你实现这一目标。如果页面不大,这可能是一种方法,因为样式将被保留为一个很好的副作用。