views:

44

answers:

1

Hi Guys,

I am trying to open a view in landscape by pushing on navigation controller but it always open in portrait.

First view is in portrait and when I click on a button then next view should be in landscape.

I am trying following code

Calling View:

ResultViewController *resultView = [[ResultViewController alloc] init];
    [[self navigationController] pushViewController:resultView animated:YES];

View that should open in landscape:

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

Is there something else to try here?

Thanks

A: 

Try..

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

and then...

- (void)viewDidLoad {
    [[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeLeft animated:YES];

}

in resultView

Jordan
I have tried that too but it only change the status bar to landscape and my resultView remains in portrait mode. Anything else I can try?
Leo
Is your view a UIViewController, UITabBarController, or UINavigationController?
Jordan