我有一个(简单的)网页打包在一个 phonegap 应用程序中。如果我启动该应用程序,它会以横向页面宽度纵向显示页面。所以文本从左下开始到左上。在右边我有一个页面应该结束的地方。
这是我看到的:
在我的 ...-Info.plist
中,支持的方向是左右横向:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
</array>
在我的 iPad 上,我锁定了屏幕旋转。启动图像在横向显示正确。
页面设计为适合固定尺寸的横向。这是我的视口(viewport):
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
并且该页面具有正确的横向宽度,但它被翻转了。我可以上下滚动。 app启动后ipad状态栏从顶部跳到左边。
更新
我将目标设备更改为仅 iPad,并且仅允许向左横向方向,现在状态栏位于顶部需要的位置。页面还在翻……我也试过做一个simple page version那应该旋转也不起作用的东西。
更新 2
在 Classes/MainViewController.m
我有:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
最佳答案
您可以检查根 Controller - shouldAutorotateToInterfaceOrientation,允许特定方向的旋转。希望对您有所帮助。
例如 Classes/MainViewController.m
中的return true
:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
//return (interfaceOrientation == UIInterfaceOrientationPortrait);
return true;
}
关于html - Phonegap 页面旋转错误,在横向模式下显示为纵向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10996676/