【发布时间】:2011-05-12 11:36:23
【问题描述】:
我想用一个 UIViewController 和两个 XIB 来处理 iPad 应用程序上的方向更改,比如说 MenuView 和 MenuViewLandscape。
那么,在 MenuViewController 的 willRotateToInterfaceOrientation 方法中,如何在不使用其他控制器的情况下更改 XIB?
我正在使用以下代码:
if( toInterfaceOrientation != UIInterfaceOrientationPortrait ){
MenuViewController *landscape = [[MenuViewController alloc]
initWithNibName: @"MenuViewLandscape"
bundle:nil
];
[self setView:landscape.view];
}
else {
MenuViewController *potrait = [[MenuViewController alloc]
initWithNibName: @"MenuView"
bundle:nil
];
[self setView:potrait.view];
}
但是当我进入 XIB 的横向视图时,横向视图控件没有正确旋转。
【问题讨论】:
标签: ipad rotation landscape nib