1

I have a tab bar view controller, which contains some navigation controllers each with a root view controller. Everything should only render in portrait. All's well. One of the child view controllers pushes another view controller using it's navigation vc, and that one I'd like to allow rotation to landscape on.

Tabbar vc
   nav vc/vc1
   nav vc/vc2
   nav vc/vc3
      pushes new vc4   <- ONLY this one should autorotate. Further more, if you're in landscape mode in this vc and hit 'back', it goes back in portrait.

The app 'line' does this - the actual 'chat' window can autorotate.

Please give me the codes! ;) I'm hoping it doesn't require messing with the transforms...

4

2 回答 2

1

要在您的 UITabBarController 应用程序上支持自动旋转,您需要子类化您的 tabBarController 上的视图控制器旋转调用,并询问当前呈现的视图控制器是否支持新方向。在您的特定情况下,将询问 vc4 是否支持方向更改,因此标签栏可以在询问时旋转。

看看这个问题:tabBarController and navigationControllers in landscape mode, episode II

于 2012-11-14T16:13:55.957 回答
0

@Colin 在您的 Tabbar 视图控制器中,将其限制为像

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

并在您的新视图控制器(vc4)中,将其限制为横向。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight) );
}

希望能帮助到你。

于 2012-11-14T16:23:33.490 回答