【问题标题】:iiview deck controller changing frame without changing interface orientation on presenting modal viewiiview 甲板控制器在呈现模态视图时更改框架而不更改界面方向
【发布时间】:2014-01-23 11:36:42
【问题描述】:

我正在使用IIViewDeckController,遇到一个很奇怪的问题如下?:

我的ViewController(这是一个IIViewDeckController)处于横向模式,然后我以模态方式在其顶部呈现一个新的视图控制器。现在模态视图控制器不支持横向模式,因此仅以纵向模式呈现。
到目前为止,一切都很顺利。

但是,一旦我尝试关闭这个模态呈现的控制器,IIViewDeckController's 视图的框架就会变成 (320,568)(我认为这个 IIViewDeckController 已经旋转到纵向模式,但我不确定)。所以我检查了self.interfaceOrientation,它显示了“4”(即UIInterfaceOrientationLandscapeLeft),这应该是实际情况。

但是这两件事让我感到困惑,因为框架指示纵向模式,而属性显示不同的东西。现在因为这个框架在不改变interfaceOrientation的情况下改变,导致视图中对象的框架计算错误。

【问题讨论】:

    标签: iphone ios7 modalviewcontroller viewdeck iiviewdeckcontroller


    【解决方案1】:

    我遇到了同样的问题,我通过在 AppDelegate 类中对 IIViewDeckController 进行分类来解决它。

    以下是需要分类的一种方法:-

    @interface IIViewDeckController (categoryForOrientation)
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation;
    @end
    
    @implementation IIViewDeckController (categoryForOrientation)
    
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
        return [self interfaceOrientation];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-30
      • 1970-01-01
      • 2014-11-28
      相关资源
      最近更新 更多