【问题标题】:Incorrect ViewController Orientation After Segue IOS7Segue IOS7 后 ViewController 方向不正确
【发布时间】:2014-08-16 22:25:25
【问题描述】:

我有 2 个ViewControllers,第一个是shouldAutoRotate-NO,第二个是shouldAutoRotate-YES。 我正在展示第二个 ViewController 与函数 presentViewController: 并使用 UIModalPresentationCurrentContext 因为我在第二个上有透明背景,仍然可以在背面查看第一个。

问题是,当我在“风景”中的第一个ViewController 中(由于shouldAutoRote-NO 而出现在肖像中)并且我呈现第二个ViewController 时,第二个出现在风景中,但是如果我将 iPhone 转回纵向 我不会旋转,除非我将手机转回横向,这会使方向重新开始正常工作。

状态栏的行为总是正确的,问题在于ViewControllers

有什么建议吗?

【问题讨论】:

    标签: ios uiviewcontroller orientation segue landscape


    【解决方案1】:
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
        // Return YES for supported orientations
            return UIInterfaceOrientationIsLandscape(interfaceOrientation);
    }
    
    -(NSUInteger)supportedInterfaceOrientations
    {
            return UIInterfaceOrientationMaskAll;
    }
    

    您可以简单地在当前视图控制器中提供您想要的方向类型。

    【讨论】:

    • shouldAutorotateToInterfaceOrientation 自 ios5 起不再支持,而且这并不能真正解决帖子中描述的问题,谢谢!!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-18
    • 2020-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多