【问题标题】:Only the top UIViewController is auto resizing on rotation, others on the navigation stack are not只有顶部的 UIViewController 会在旋转时自动调整大小,导航堆栈上的其他人不会
【发布时间】:2017-02-28 13:03:33
【问题描述】:

我的设置是一个 UINaviagtionController 控制 UIViewControllers 堆栈,并勾选了 Portrait、Landscape Left 和 Landscape Right screenshot

我的 ViewControllerA 处于纵向模式,并通过 segue 或通过添加 ViewControllerB

[self.navigationController pushViewController:newMenuViewController animated:YES];

在 ViewControllerB 上,我将设备旋转到横向,然后弹出 ViewControllerB,当显示 ViewControllerA 时,它仍处于纵向模式,黑色覆盖屏幕的其余部分(我只能假设这是 UIWindow)。

Screenshot

似乎无法在新项目中重现问题。

有什么想法吗?

【问题讨论】:

    标签: ios objective-c uiviewcontroller uinavigationcontroller orientation


    【解决方案1】:

    根据您的屏幕截图,视图旋转但没有调整大小...检查您的约束和/或自动调整大小的蒙版。

    【讨论】:

    • 谢谢,但检查了所有这些,没有运气。可能应该提到这是应用程序范围内的,每个 ViewController 都会发生,但是是旋转和调整大小的好地方,从来没有真正想到过。
    • 可能还应该提到 viewControllerB 确实会调整大小和旋转,只有堆栈上的其他人不会
    • 嗯...你继承 UINavigationController 了吗?一定有什么事情发生了。在您的代码中搜索以下三个中的任何一个: shouldAutorotate ...supportedInterfaceOrientations ... PreferredInterfaceOrientationForPresentation
    • 我将 UINavigationController 子类化以尝试解决问题,但没有运气,而且这些都没有在我的代码中
    • 这种事情会让我发疯,直到我弄明白......你有没有我可以抓住的一个小而无关紧要的项目?还是只是在您无法共享的大型项目中?
    猜你喜欢
    • 2019-09-14
    • 1970-01-01
    • 1970-01-01
    • 2011-01-25
    • 1970-01-01
    • 2017-06-29
    • 1970-01-01
    • 2012-11-28
    • 2018-11-11
    相关资源
    最近更新 更多