2011-06-08 67 views
4

我有,我想加載一些HTMLUIWebView的切換scalespagetofit

<html><body style="margin: 0; padding: 0;"><img src="/++video?cameraNum=15&width=640&height=480&noScaleUp=1&auth=cmhiOkJpZ01hYw==&7427" width=341 height=256></body></html> 

當我設置scalesPageToFit的情況= YES中(在IB選中)我可以捏到縮放網頁視圖,但的初始加載圖像的網頁流量過小:

enter image description here

如果我設置scalesPageToFit = NO在(IB中未選中),然後將視頻輸入正確的秤在加載時,但現在用戶無法捏縮放圖片。 enter image description here

當然,我需要的是網頁加載正確的大小,然後允許用戶捏縮放,雙擊重置手勢。

任何人都知道的方式來做到這一點在代碼或JavaScript等...?

感謝,

羅布

回答

4

使用META標籤在你我有一個在馬項目中使用的一個樣本。

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<meta name="viewport" id="iphone-viewport" content="minimum-scale=1.0, maximum-scale=1.0, width=device-width> 

這是非常有用?

+0

是的!這照顧了我的情況。順便說一下,這裏有一個蘋果文檔的完整參考:[鏈接](http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html)和這裏[鏈接](http://developer.apple.com/library/safari/#documentation/appleapplications/reference/SafariHTMLRef/Articles/MetaTags.html%23//apple_ref/doc/uid/TP40008193) – Rob 2011-06-09 13:57:29