我有一个navigationController作为rootViewController,它只是肖像,在工作流程中我将自定义navigationController作为模式在横向模式下呈现 . 所有这一切都有效,但是当我在横向模式中关闭提供的navigationController时,展示者/父视图将以横向显示 . 这仅在设备旋转时发生,我已经检查了Plist和其他位置(故事板中的VC方向标志),其中它仅设置为纵向 .

提供的ViewController Modally有一个自定义的NavigationController,我将覆盖-shouldAutorotate:返回NO,-supportedInterfaceOrientations:返回UIInterfaceOrientationMaskLandscapeLeft和-preferredInterfaceOrientationForPresentation:返回UIInterfaceOrientationLandscapeLeft .

需要VC布局:

  • RootViewController - 仅限纵向

  • presentViewController - 风景

  • RootViewController - 纵向,当关闭Landscape VC时 .

我已经尝试了堆栈溢出中陈述的许多方法:

  • 为NavigationController创建类别,设置为rootViewController,并为-supportedInterfaceOrientations指定方向为肖像:和--preferredInterfaceOrientationForPresentation: .

  • [UIApplication setStatusBarOrientation:animated:]

  • 在解除完成处理程序中设置方向 .

等等

但似乎没有工作,任何想法或帮助?