Search code examples
iosuinavigationcontrolleruiinterfaceorientation

UINavigation with LandscapeRight Only


My Application only supports landscape right.

If I start the app holding iPhone in landscape, all successive views are presented in landscape mode. And they do not autorotate to any orientation since my app forbids that using following code in all view controllers

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

However, if I start the App with iPhone held in Portrait Mode, my views are displayed and pushed in Portrait Mode :o (My view controllers do not support Portait Mode at all)

The very first view of my application is Presented as ModalView on a UINavigationController, which is then dismissed and a new HomeController is pushed on to the stack.

How do I re-structure my Application so that the Navigation Controller Pushes Views Correctly?

Here is some code of my didFinishLaunchingWithOptions method

_splashController = [[SplashController alloc] initWithNibName:kViewForSplash bundle:nil];

_navC = [[UINavigationController alloc] init];
_splashController.navC = _navC;
_navC.navigationBarHidden = YES;
[application setStatusBarHidden:YES];

[self.window addSubview:_navC.view];
[_navC presentModalViewController:_splashController animated:YES];

Solution

  • try setting properties Initial interface orientation and Supported interface orientations to Landscape (right) in Info.plist

    this should force the app to launch in Landscape no matter how you hold it