views:

135

answers:

2

Hello there dudes.

Quick problem:

I have an UITabBarController with 2 navigation controllers [lets call them Left and Right Controller]

On the default selected Left Controller I can push a new View Controller that detects interface orientation.

On the Right Controller I can push the same View Controller but it won't detect interface orientation, or for that matter, It won't even go into the shouldAutoRotateInterface method at all T___T

Haaalp!!

If it is of any relevance, the View Contoller that I'm pushing use the hidesBottomBarWhenPushed property.

A: 

does your uitabbarcontroller implement the auto rotate? any child viewcontroller that wants to implement autorotate has to have its parent implement autorotate.

Jesse Naugher
Could yo tell me where can I set this property?The project was created with the TAB BAR template, so the tabBarController is on the mainwindow.xib as an IBOutlet of the Appdelegate.The weird thing is.... the controller on the left works ok.. it autorotates... but the one on the right doesn't T___T
Ayton McLoving
A: 

Most likely this is your problem:

Tab bar controllers support a portrait orientation by default and do not rotate to a landscape orientation unless all of the root view controllers support such an orientation. When a device orientation change occurs, the tab bar controller queries its array of view controllers. If any one of them does not support the orientation, the tab bar controller does not change its orientation.

The solution is to override the following method on every view controller leading to your view:

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
    return YES;
}

For example, instead using the default UITabBarController in IB, replace it with your own subclass containing just the method above.

Jano