代码之家  ›  专栏  ›  技术社区  ›  Nick

只有主窗口视图的直接子视图才能获得iOS设置的方向?

  •  0
  • Nick  · 技术社区  · 15 年前

    我是否有责任通知其他对象更改,如果是,有什么好方法?

    我已经研究了设置我的孩子们的viewcontrollers界面方向,但那是只读的。

    提前谢谢,

    1 回复  |  直到 15 年前
        1
  •  0
  •   tribeca    15 年前

    我发现了那个电话

    willRotateToInterfaceOrientation
    

    didRotateFromInterfaceOrientation
    

    您将要显示的视图控制器的一部分为我工作。在我的例子中,我使用了一个导航控制器,这样就可以很容易地跟踪接下来将要显示给用户的内容。下面是一些代码从我的项目。

    - (void)navigationController:(UINavigationController *)navigationController 
             didShowViewController:(UIViewController *)viewController 
             animated:(BOOL)animated {
        [viewController willRotateToInterfaceOrientation:
            [self interfaceOrientation] duration:0];    
    }
    
    推荐文章