0

每当我的应用程序旋转时,只有我将其视图作为子视图添加到主窗口的 viewController 会更新他的 interfaceOrientation 属性,其余的仍然不知道设备已旋转的事实。

通知其他对象更改是我的责任吗?如果是,有什么好的方法可以做到这一点?

我已经研究过设置我的孩子视图控制器的 interfaceOrientation ,但那是只读的。

提前致谢,

4

1 回答 1

0

我发现打电话

willRotateToInterfaceOrientation

和/或

didRotateFromInterfaceOrientation

你要展示的视图控制器对我有用。就我而言,我使用的是导航控制器,因此很容易跟踪接下来将向用户显示的内容。下面是我项目中的一些代码。

- (void)navigationController:(UINavigationController *)navigationController 
         didShowViewController:(UIViewController *)viewController 
         animated:(BOOL)animated {
    [viewController willRotateToInterfaceOrientation:
        [self interfaceOrientation] duration:0];    
}
于 2010-08-09T18:06:50.453 回答