NextRev
NextRev

Reputation: 1711

Launching navigation controller in landscape?

I'm trying to make a landscape app that uses navigation controller, but I can't get the app to launch in lanscape mode. Once I'm in another view and I use [self.navigation popToRootViewControllerAnimated:YES]; then the root view is in landscape. Why isn't it in landscape from the launch of the app.

I've already put it in landscape mode in Interface Builder and I've already implemented the following code.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);


}

Can someone please explain this to me. Am I supposed to be doing something in the appdelegate?

Upvotes: 0

Views: 356

Answers (2)

tc.
tc.

Reputation: 33592

See the Info.plist key reference. In particular, set either

  • <key>UIInterfaceOrientation</key> <string>UIInterfaceOrientationLandscapeRight</string>
  • <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeLeft</string> </array>

The second one lets your app start up in both orientations, but is only supported on OS 3.2+, so you probably want to include the first one as well. "LandscapeRight" seems more common than "LandscapeLeft" for landscape-only apps.

Upvotes: 1

Jesse Naugher
Jesse Naugher

Reputation: 9820

try adding the key-value pair 'supported interface orientations' in the plist of the application.

Upvotes: 0

Related Questions