3

我不知道为什么,但是当我旋转 iPhone 时,我的 PhoneGap 应用程序没有旋转屏幕。发布代码是没有用的,因为它不适用于最简单的代码:<div>Hello World!</div.

我也检查了方向设置: 在此处输入图像描述 在此处输入图像描述

这是一个例子(在实际设备上也是如此): 在此处输入图像描述

4

2 回答 2

3

对我来说同样的问题。我解决了这个问题,在我的代表上为 iOS6 添加了以下几行:

- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
    NSUInteger supportedInterfaceOrientations = (1 << UIInterfaceOrientationPortrait) | (1 << UIInterfaceOrientationLandscapeLeft) | (1 << UIInterfaceOrientationLandscapeRight) | (1 << UIInterfaceOrientationPortraitUpsideDown);

    return supportedInterfaceOrientations;
}

另外,在您的主控制器上,添加:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return true;
}
于 2012-11-12T18:34:09.520 回答
0

更改类文件夹中的 MainViewController.m

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    //return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
     return true;
}

并且在 AppDelegate.m 上仍然在类文件夹中

- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
    // iPhone doesn't support upside down by default, while the iPad does.  Override to allow all orientations always, and let the root view controller decide what's allowed (the supported orientations mask gets intersected).
    NSUInteger supportedInterfaceOrientations = (1 << UIInterfaceOrientationPortrait) | (1 << UIInterfaceOrientationLandscapeLeft) | (1 << UIInterfaceOrientationLandscapeRight) | (1 << UIInterfaceOrientationPortraitUpsideDown);

    return supportedInterfaceOrientations;
}
于 2014-02-20T01:22:19.440 回答