PhoneGap上的childBrowser仅以纵向显示

时间:2011-10-19 06:13:04

标签: ios html5 cordova

我在iOS 5.0,XCODE 4.2,phonegap 1.1.0上使用了childbrowser,我只能在纵向模式下启动它。我的应用程序支持所有4个视图但是当我选择a时,我只能以纵向模式访问浏览器。我收到此错误消息:

视图控制器从-shouldAutorotateToInterfaceOrientation返回NO:用于所有接口方向。它应至少支持一种方向。

但我知道很少的xcode - 所以我无法解决这个问题:(

帮助

1 个答案:

答案 0 :(得分:3)

我遇到了同样的问题,如果你在ChildBrowserViewController中查看有一个名为shouldAutorotateToInterfaceOrientation的函数。

前几行会查看支持的方向的配置,但只有在设置了多个方向时才会旋转。我只有横向设置,所以它没有这样做。

如果您将autoRotate设置为YES或注释掉if块,它将检查当前方向是否受支持,如果是,它将旋转到它。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation 
{
    //BOOL autoRotate = [self.supportedOrientations count] > 1; // autorotate if only more than 1 orientation supported
    //if (autoRotate)
    //{
        if ([self.supportedOrientations containsObject:
             [NSNumber numberWithInt:interfaceOrientation]]) {
            return YES;
        }
    //}

    return NO;
}