嗨,我正在开发一个sencha-touch-2应用程序,它将嵌入到iPhone UIWebview上。UIWebview大小为280x420,以iPhone屏幕为中心。在sencha开发上,一切都很完美,但是当我尝试将sencha构建到生产中时,sencha页面的大小就会散落或不符合UIWebview的大小。请参阅下面的代码
森查
在index.html的主体中添加元标记
<body>
<meta name="viewport" content="width=device-width; initial-scale=1; maximum-scale=1;">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<div id="appLoadingIndicator">
<div></div>
<div></div>
<div></div>
</div>
</body>此代码适用于开发,但当更改到生产时,页面会发生更改。我应该做什么来使它在生产的建设,因为生产是非常快的加载。
发布于 2012-07-01 12:15:39
试试这个,只需在html body标记中添加这个脚本即可。
<script type="text/javascript">
setTimeout(function(){
var meta = document.createElement('meta');
meta.setAttribute("name","viewport");
meta.setAttribute("content","width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;");
(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(meta);
},1000);
</script>Sencha touch 2.0将用内置的元标记覆盖您的脚本。因此,所发生的是您的元标记将被加载,但将被替换为它自己的元标记。
https://stackoverflow.com/questions/11270290
复制相似问题