View Full Version : UIOrientation

May 24, 2011, 08:45 AM
Hai Guys!

Having some issues..
I have an app with a root controller, this is landscape only. I checked this all in the nibs, and edited the .plist, so it's landscape(left/right) only. and my method returns

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));

So when I push my special controller onto the stack (it's a navigationcontroller). it also goes landscape, and that's possible going to portrait mode. but if i switch the second controller to portrait mode, and then go back to my root, this is also portrait mode. So it doesn't do a second check, and changes again.. Any idea how I would go on checking how to fix this?

Gz, Noxx

May 24, 2011, 10:09 AM
Try this for your landscape view.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape(interfaceOrientation);

May 25, 2011, 03:06 AM
Tried all that, it's a headbreaker, since it's for only demo'ing, and not appstore material, i'm using this private method now..

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];

It's undocumented, but it works great ;/
I'll have to figure it out later.