Ios 方向更改时视图控制器之间的导航

Ios 方向更改时视图控制器之间的导航,ios,objective-c,orientation-changes,Ios,Objective C,Orientation Changes,我正在开发使用两个ViewController A和B的ios应用程序。当B仅处于纵向模式时,A支持横向和纵向两种方向。我的目标是,当我从A导航到B时,B viewcontroller始终处于纵向模式。我在navigationcontroller中对B viewcontroller进行限制 - (BOOL)shouldAutorotate { _navigation = (MBNavigationController *) self.frontViewController;

我正在开发使用两个ViewController A和B的ios应用程序。当B仅处于纵向模式时,A支持横向和纵向两种方向。我的目标是,当我从A导航到B时,B viewcontroller始终处于纵向模式。我在navigationcontroller中对B viewcontroller进行限制

  - (BOOL)shouldAutorotate

{
    _navigation = (MBNavigationController *) self.frontViewController;

    id currentViewController = [_navigation visibleViewController];

    if ([currentViewController isKindOfClass:[MBViewController class]])
        return NO;

    return YES;
}

当A处于纵向,我导航到B时,一切正常。但当A处于横向模式时,我也会这样做,B控制器视图的一部分在场景外。请帮助我找到正确的解决方案。

一个可能的解决方案是在B viewController中提供另一个navigationController,其中

// sysversion>=ios6
- (BOOL)shouldAutorotate
{
    return NO;
}
// sysversion<=ios5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

你能详细解释一下吗?在这种情况下,我应该有什么故事板树?两个导航控制器。导航控制器一个人的根视图控制器是一个视图控制器。二的根视图控制器是B视图控制器。设置应单独自动旋转