iPhone SDK: Orientation (Landscape and Portrait views)

Posted by domness on Stack Overflow See other posts from Stack Overflow or by domness
Published on 2009-01-10T15:53:13Z Indexed on 2010/04/04 2:33 UTC
Read the original article Hit count: 329

Filed under:

Okay, I've got my normal app which is in portrait mode. I can force my app to go to landscape mode for a view (using navigationcontroller and viewcontroller) like this:

- (void)viewWillAppear:(BOOL)animated {
    [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
}

But then when I go back to the main menu (tableview) it goes straight back to portrait. I try this code:

- (void)viewWillAppear:(BOOL)animated {
    [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];
}

But that doesn't work..

Any ideas?

© Stack Overflow or respective owner

Related posts about cocoa-touch