Android的webview中html5的相同代碼運行自然,但contentSize在iOS上更大。是否它與html5代碼有一些錯誤?我可以在iOS客戶端上做一些修復嗎?UIWebview的contentSize不適合手機屏幕
0
A
回答
0
如果您使用UIWebView加載內容,則可以將webview的內容設置爲適合。如下:
myWebView.scalesPageToFit = YES; //true for Swift
0
webView.scalesPageToFit = YES;
應大小的網頁,以適合的UIWebView的大小。用戶然後可以選擇放大和縮小頁面。你的問題可能是因爲webview沒有正確定位。如果您的視圖控制器視圖完全適合屏幕,請將其添加到您的代碼中。
webView.frame=self.view.bounds;
+0
TKS的回答,但沒有工作; – JohnChen
0
對不起,這是我的代碼,如果有任何我失去了發佈,請告訴我,TKS!
- (UIWebView *)webView
{
if (!_webView)
{
_webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 45, self.view.width, self.view.height - 45)];
_webView.scalesPageToFit = YES;
_webView.scrollView.scrollEnabled = NO;
_webView.allowsInlineMediaPlayback = YES;
_webView.mediaPlaybackRequiresUserAction = NO;
[self.view addSubview:_webView];
}
return _webView;
}
<head>
<meta charset="utf-8">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="yes" name="apple-touch-fullscreen">
<meta mame="renderer" content="webkit">
<meta content="telephone=no,email=no" name="format-detection">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="stylesheet" type="text/css" href="lib/type_2/images/engine/style.css" media="screen">
<link rel="stylesheet" href="lib/type_2/css/style.css" type="text/css" media="screen">
<link rel="stylesheet" href="css/album.css">
<title>
相冊
</title>
<script type="text/javascript" src="js/template.js"></script>
<script id="itemsTpl" type="text/html">
{{each list as value i}}
<li class="captionImg"><img src="{{value}}" alt="{{i}}" title="" /></li>
{{/each}}
</script>
</head>
<body>
<div id="wrapper">
<i class="i i-1"></i>
<div><div id="wowslider-container" class="ws_gestures" style="font-size: 10px;"><div class="ws_images"><div style="width: 100%; visibility: hidden; font-size: 0px; line-height: 0;"><img src="/var/mobile/Containers/Data/Application/B1C82725-9EFC-4A90-BFE2-27FD701A0A9A/Documents/Image/854ABED8-D819-4BB0-B772-DD73A64153C7.jpg" alt="0" title="" style="width: 100%;"></div><div class="ws_list" style="position: absolute; top: 0px; height: 100%; transform: translate3d(0px, 0px, 0px); width: 300%; display: table; left: 0%;"><div class="ws_swipe_left" style="position: absolute; top: 0px; height: 100%; overflow: hidden; width: 33.333333333333336%; left: -33.333333333333336%;"><img src="/var/mobile/Containers/Data/Application/B1C82725-9EFC-4A90-BFE2-27FD701A0A9A/Documents/Image/10B68731-D2CA-43A8-9A63-D1C964982BED.jpg" alt="2" title="" style="visibility: visible; width: 100%; height: auto; margin-top: 0px; margin-left: 0px;"></div><ul id="items" style="width: 100%;">
<li class="captionImg" style="display: table-cell; float: none; width: auto; font-size: 0px;"><img src="/var/mobile/Containers/Data/Application/B1C82725-9EFC-4A90-BFE2-27FD701A0A9A/Documents/Image/854ABED8-D819-4BB0-B772-DD73A64153C7.jpg" alt="0" title="" style="visibility: visible; width: 100%; height: auto; margin-top: 0px; margin-left: 0px;"></li>
<li class="captionImg" style="display: table-cell; float: none; width: auto; font-size: 0px;"><img src="/var/mobile/Containers/Data/Application/B1C82725-9EFC-4A90-BFE2-27FD701A0A9A/Documents/Image/5270A5C5-F840-447D-BB5B-585A3E163023.jpg" alt="1" title="" style="visibility: visible; width: 100%; height: auto; margin-top: 0px; margin-left: 0px;"></li>
<li class="captionImg" style="display: table-cell; float: none; width: auto; font-size: 0px;"><img src="/var/mobile/Containers/Data/Application/B1C82725-9EFC-4A90-BFE2-27FD701A0A9A/Documents/Image/10B68731-D2CA-43A8-9A63-D1C964982BED.jpg" alt="2" title="" style="visibility: visible; width: 100%; height: auto; margin-top: 0px; margin-left: 0px;"></li>
</ul><div class="ws_swipe_right" style="position: absolute; top: 0px; height: 100%; overflow: hidden; width: 33.333333333333336%; left: 100%;"><img src="/var/mobile/Containers/Data/Application/B1C82725-9EFC-4A90-BFE2-27FD701A0A9A/Documents/Image/854ABED8-D819-4BB0-B772-DD73A64153C7.jpg" alt="0" title="" style="visibility: visible; width: 100%; height: auto; margin-top: 0px; margin-left: 0px;"></div></div></div><div style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; overflow: visible;" class="ws_effect"><div class="ws_parts"></div><div class="ws_zoom"></div><div style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; overflow: hidden;"></div></div><div class="ws_effect" style="position: absolute; background-size: cover; left: 0px; top: 0px; width: 100%; height: 100%; -webkit-backface-visibility: hidden;"><div class="ws_effect" style="position: absolute; background-size: cover; left: 0px; top: 0px; width: 100%; height: 100%; -webkit-backface-visibility: hidden; transform-style: preserve-3d; perspective: 2000px; z-index: 8; overflow: visible;"></div></div><div class="ws_effect" style="overflow: visible; position: absolute; top: 0px; left: 0px; width: 1280px; height: 0px; transform: translate3d(0px, 0px, 0px); transform-origin: 640px 360px 0px; perspective: 2000px; display: none;"></div><div class="ws_video_btn"><div></div></div></div></div>
</div>
<script type="text/javascript" src="lib/type_2/images/engine/jquery.js"></script>
<script type="text/javascript" src="lib/type_2/images/engine/wowslider.js"></script>
<script type="text/javascript" src="lib/type_2/images/engine/script.js"></script>
<script type="text/javascript">
var re=null;
function initData(result){
//result={"time": "3000","list": ["imgs/1.jpg", "imgs/2.jpg","imgs/3.jpg"]};
re=result;
//alert(result)
$("#wowslider-container").html("<div class=\"ws_images\"><ul id=\"items\"></ul></div>");
var html = template('itemsTpl', result);
document.getElementById('items').innerHTML="";
document.getElementById('items').innerHTML = html;
banner(result.time, result.list.length-1);
}
function doing(index){
if(index==0){
wowSlider=null;
var html="<div class=\"last\"><img src=\""+re.list[re.list.length-1]+"\" /></div>" ;
document.getElementById('wowslider-container').innerHTML = html;
// 結束了
}
}
</script>
</body>
相關問題
- 1. 手機間隙屏幕圖像不適合屏幕
- 2. CSS(手機)適合屏幕頁面
- 3. 網站不適合在手機屏幕上的全屏
- 4. 流星手機畫布不適合屏幕
- 5. UIWebview:不旋轉,不調整大小以適合整個屏幕
- 6. 適合屏幕
- 7. 如何使div適合100%的手機屏幕
- 8. 如何根據手機屏幕的寬度適合Ringdroid波形
- 9. 佈局不適合屏幕
- 10. Cardview不適合屏幕
- 11. Bootstrap Modal不適合屏幕
- 12. 圖像不適合屏幕
- 13. Smartgit Ubuntu不適合屏幕
- 14. UIWebview適合屏幕,但不能放大iphone編程
- 15. UIWebView不自動調整大小以適合屏幕
- 16. 使文本輸入框適合手機屏幕
- 17. UIWebView ContentSize高度
- 18. 如何讓網站適應不同尺寸的手機屏幕?
- 19. 如何適應元素在不同的手機屏幕
- 20. 的Iframe適合屏幕
- 21. Android屏幕在不同的手機上
- 22. 適合從不同的Orthographic相機位置的屏幕
- 23. 適合不同的屏幕尺寸
- 24. 適合不同屏幕的背景
- 25. 的ListView側指數不適合屏幕
- 26. Android ImageView不適合較大的屏幕
- 27. UIImageView不適合我的屏幕
- 28. CSS不適用於小屏幕尺寸手機
- 29. 問題與網站,不結垢,以適應手機屏幕
- 30. 在iOS5和iOS6中縮放UIWebView以適合全屏幕
請添加代碼 – oremag14jf