Phonegap在iPad和iPhone之间无法正确缩放 [英] Phonegap not scaling properly between iPad and iPhone

查看:167
本文介绍了Phonegap在iPad和iPhone之间无法正确缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Phonegap 0.9.6开发了一个iPad的应用程序。
似乎工作正常。



应用程序的主要元素是768像素宽,因此缩放不是一个问题的一种方式或其他。 / p>

现在我正在试验在iPhone上运行相同的东西。



我在顶部有这个元标记

 < meta name =viewportcontent =user-scalable = no ,width = device-width> 

似乎在iPhone浏览器上正常工作:我可以将浏览器指向我本地运行的服务器



如果我创建一个主屏幕版本的页面,所以它更多的是一个WebApp(仍然不是使用PhoneGap)我仍然得到缩放,虽然现在它有点关闭:图像有点太宽,一个小条在右边卷起屏幕。



但是当我在Phonegap尝试的东西我没有得到任何缩放。页面总是以正常的分辨率显示,所以我只看到它的顶部季度。



我有尝试以下所有:
*在XCode目标设置中将Summary - > Devices从iPad更改为Universal。
*在'​​run'的'info'选项卡下使用'enable display scaling'
*每一个技巧的排列我可以想到的meta'viewport'标签:设置最小/最大缩放,设置初始比例,设置宽度为固定数字等。



对于最后一个项目,我可以看到我在iPhone的浏览器(和HomeScreen版本)中反映的调整,但是PhoneGap从来没有出现:右角。

解决方案

你应该能够通过HTML来控制缩放在您的PhoneGap.plist文件中:



EnableViewportScale:YES


I developed an app for iPad using Phonegap 0.9.6. Seems to be working fine.

The main element in the app is 768 px wide, so scaling has not been a problem one way or the other.

Now I am experimenting with running the same thing on an iPhone.

I have this meta tag at the top of my html in the 'head' section:

<meta name="viewport" content="user-scalable=no, width=device-width">

It seems to work fine on the iPhone browser: I can point the browser to my locally-running server, the page gets scaled appropriately so it fits in the iPhone screen.

If I make a 'Home Screen" version of the page so it's more of a WebApp (still not using PhoneGap) I still get scaling, although now it's a little off: the image is a little too wide, a small strip on the right winds up offscreen.

But when I try things in Phonegap I am getting no scaling at all. The page always shows up at normal resolution, so I am seeing just the top quarter of it.

I have tried all of the following: * Changing Summary->Devices from iPad to Universal in XCode target settings. * Mucking with the 'enable display scaling' widget under the 'info' tab of the 'run' item on the scheme for this build. * Every permutation of trick I can think of for the meta 'viewport' tag: setting min/max scaling, setting initial scale, setting width to fixed numbers, etc.

For that last item, I can see tweaks I make reflected in the Browser on the iPhone (and the HomeScreen version), but the PhoneGap never budges: I always get the same upper-right corner. I can't seem to make that move at all.

解决方案

You should be able to control the scaling trough HTML by putting the following in your PhoneGap.plist file:

EnableViewportScale : YES

这篇关于Phonegap在iPad和iPhone之间无法正确缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆