iOS 8错误导航堆栈/旋转?

时间:2014-10-17 14:09:43

标签: ios cocoa-touch uiviewcontroller

我有三个UIViewControllers:vc1vc2,vc3连续出现在UINavigationController上。 vc1具有以下轮播属性:

- (BOOL)shouldAutorotate
{
    return YES;
}

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

vc2vc3具有以下轮播属性:

- (BOOL)shouldAutorotate
{
    return YES;
}

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    return (toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);

}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAllButUpsideDown;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return self.presentedViewController.interfaceOrientation;
}

vc3上(当然在导航堆栈上有vc1vc2),如果用户按下重启按钮,我希望它将它们带回VC1:

- (void) restartButtonPushed
{
    [self.navigationController popToRootViewControllerAnimated:YES];
}

这通常有效,但是如果我在vc3处于横向模式,当我按下重启时,它会以横向模式返回vc1。而在< iOS8,vc1将被强制进入纵向模式。这是iOS8中的错误吗?或者可能是在iOS8中修复了一些东西,它暴露了我是如何以错误的方式做到的?

有趣的是,如果我在横向模式和vc2上按下重启按钮,它会完全正常工作,vc1会被强制进入纵向模式。

0 个答案:

没有答案