tabbarcontroller +导航控制器的方向问题

问题描述:

我有一个TabBarController有两个选项卡。每个选项卡中都有一个NavigationController。现在,如果第一个选项卡被选中,我旋转应用程序,然后shouldAutorotateToInterfaceOrientation:被调用的第一个选项卡导航控制器的rootViewController,这是正确的,但是当我选择第二个选项卡,然后我旋转设备,然后仍然shouldAutorotateToInterfaceOrientation:第一个选项卡的方法获取调用。tabbarcontroller +导航控制器的方向问题

我想以不同的方式布局不同的选项卡。 任何帮助,将不胜感激。由于

我觉得this应该回答的查询,如果每个选项卡的根视图控制器支持方向

+0

谢谢,帮助。 – Ideveloper 2011-05-04 06:22:14

标签栏控制器只能切换到另一个方向。这是有道理的,否则当用户选择另一个选项卡时,用户会以某种方式切换方向。

重写此方法并在视图中调用此方法将出现。

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration 
{ 
    if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) 
    { 

    } 
}