gpt4 book ai didi

cordova - 在 iOS 6 上,PhoneGap 2.1 iPad 应用程序不再自动旋转

转载 作者:行者123 更新时间:2023-12-02 16:12:35 26 4
gpt4 key购买 nike

在 iOS 6 上运行应用程序时,我的应用程序不再成功自动旋转。我已经更新到 Cordova 2.1,并且我的 MainViewController.m 文件(它是 CDViewController 的子类)中有以下代码,以与新的 iOS6 方式兼容处理自动旋转:

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

// iOS 6
- (BOOL)shouldAutorotate {
return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
NSUInteger ret = 0;

if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait])
ret = ret | (1 << UIInterfaceOrientationPortrait);
if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortraitUpsideDown])
ret = ret | (1 << UIInterfaceOrientationPortraitUpsideDown);
if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight])
ret = ret | (1 << UIInterfaceOrientationLandscapeRight);
if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft])
ret = ret | (1 << UIInterfaceOrientationLandscapeLeft);

return ret;
}

最佳答案

在您的 AppDelegate.m 中,您需要将以下内容添加到 didFinishLaunchingWithOptions

[self.window setRootViewController:self.viewController];

添加此内容后,旋转应该再次开始工作。它适用于我的两个应用程序。

关于cordova - 在 iOS 6 上,PhoneGap 2.1 iPad 应用程序不再自动旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12866938/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com