2011-01-25 33 views
0

我在UIWebView中加載一個簡單的html文件。該html包含網絡攝像機的單個圖像。刷新uiwebview中的html文件內容(iphone)

<img id="image" src="http://server.tld/lastwebcamimage.jpg" width="300" height="245" /> 

現在我想刷新此HTMLFILE /圖像每6秒,並顯示更新的網絡攝像頭圖像。

我想:

<meta content="no-cache" http-equiv="cache-control"> 
<meta content="no-cache" http-equiv="pragma"> 
<meta content="6" http-equiv="refresh"> 

<script type="text/javascript"> 
    var active = window.setInterval("reloadMe()", 6000); 
    function reloadMe() { 
     window.location.reload() 
    } 
</script> 

它doenst工作。任何其他知道如何刷新頁面?

Thx。

回答

4

安排一個NSTimer每6秒觸發一次並致電-[UIWebView reload]

+0

這是關於事情的最好方式,除非他有其他內容,他不想刷新。儘管iPhone屏幕上沒有太多空間,但如果情況如此,他可能會重新考慮。 – 2011-01-25 14:51:55