仅在横向显示特定的viewcontroller,但支持iPad多任务功能

时间:2015-12-10 14:20:43

标签: iphone ipad uinavigationcontroller screen-orientation multitasking

我正在为iPad和iPad开发应用程序苹果手机。 由于Multitaskingfeatures,该应用程序在iPad上支持所有方向。 在iPhone上我的应用程序仅支持Portrait。

对于一个特定的ViewController,我希望两台设备只支持Landscape。 在iPhone上使用以下解决方案:

我在.plist中禁用了所有方向,并使用了两个Navigationcontroller。 一个用于风景,一个用于肖像。

将我的VC推向风景:

LandscapeNavigationController *navController = [[LandscapeNavigationController alloc] init];
    [UIApplication sharedApplication].keyWindow.rootViewController = navController;
    [navController pushViewController:[Logic sharedInstance].myLandscapeViewController animated:YES];

我的NavigationController中的代码:

- (NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskLandscape;
}

- (BOOL)shouldAutorotate {
    return YES;
}

我的问题是我无法在代码中处理iPad上的方向,因为我必须启用.plist中的所有Orientations来支持Multitasking。 因此我的supportedInterfaceOrientations中的委托方法Navigationcontroller将不会被调用。

是否有人想知道在iPad上支持multitasking并允许一个特定ViewController只有一个supportetInterfaceOrientation

0 个答案:

没有答案