简体   繁体   English

在iPad上使用iPhone尺寸而非iPad尺寸打开iPhone应用程序(Phonegap包装的应用程序)

[英]Open iPhone app (Phonegap wrapped app) on iPad with iPhone dimensions instead of iPad dimensions

Before iOS 7, iPhone apps used to launch on iPad apps with iPhone dimensions. 在iOS 7之前的版本中,iPhone应用程序曾经在具有iPhone尺寸的iPad应用程序上启动。 However, now the apps launch with iPad dimensions. 但是,现在这些应用程序将以iPad尺寸启动。

Is there a way to revert this functionality? 有没有办法还原此功能? We tried playing with different viewport settings, but those failed to do anything. 我们尝试使用不同的视口设置进行播放,但这些操作无济于事。

Here's the newest viewport setting we tried: <meta name='viewport' content='initial-scale=1.0,user-scalable=no,maximum-scale=1' /> 这是我们尝试过的最新视口设置: <meta name='viewport' content='initial-scale=1.0,user-scalable=no,maximum-scale=1' />

Our app is written with HTML5 and uses Phonegap as a wrapper. 我们的应用使用HTML5编写,并使用Phonegap作为包装器。

We also considered JavaScript solutions to determine the device width at run time, but again, this fails because the apps launch with iPad dimensions instead of iPhone dimensions. 我们还考虑了JavaScript解决方案来确定运行时的设备宽度,但是同样失败了,因为应用程序以iPad尺寸而非iPhone尺寸启动。

Are you iPad user? 您是iPad用户吗? In iOS 6 and below behaviour was awful. 在iOS 6及以下版本中,行为非常糟糕。

If you want to your users would be happy, use full size app. 如果您希望用户满意,请使用全尺寸应用程序。

Why are you trying change this behaviour? 您为什么要尝试更改此行为?

If your PhoneGap app is built for iPhone only instead of universal then no changes to the HTML/CSS/JavaScript will impact this. 如果您的PhoneGap应用仅针对iPhone而非通用应用而构建,那么对HTML / CSS / JavaScript的任何更改均不会对此产生影响。

You can either change you app to be universal and then choose what happens when it is running on an iPad, or be at the mercy of the operating system on how it will display. 您可以将您的应用更改为通用,然后选择在iPad上运行时会发生什么,或者由操作系统决定如何显示。

To be honest, I haven't tried any iPhone-only apps on my iPad since iOS 7, so I was unaware of the change. 老实说,自iOS 7以来,我还没有在iPad上尝试过任何仅iPhone的应用程序,因此我没有意识到这一变化。

Perhaps some others will know if there are other options without building the app as Universal (since you stated you don't want to do that). 也许其他一些人会知道是否有其他选项而不将应用程序构建为通用(因为您说过您不想这样做)。

This worked for us: using <meta name="viewport" content="initial-scale=1"> instead of <meta name="viewport" content="width=device-width, initial-scale=1"> . 这对我们有用:使用<meta name="viewport" content="initial-scale=1">而不是<meta name="viewport" content="width=device-width, initial-scale=1"> Found here: Transition to iOS 7: correct viewport setting for jQuery/iPhone Webapps viewed on iPads 在此处找到: 过渡到iOS 7:在iPad上查看的jQuery / iPhone Webapp的正确视口设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM