If my application is in the Landscape position and then they press a button to load the info view, how can I set the info view to only support the portrait position, and therefore change the orientation to portrait when the view is loaded?
Asked
Active
Viewed 2,406 times
2 Answers
1
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (UIInterfaceOrientationPortrait == interfaceOrientation )
}

Vjy
- 2,106
- 3
- 22
- 34
-
This won't force it to turn to portrait if it's currently in landscape mode when loaded. – David Liu Dec 13 '10 at 20:43
-
That doesn't work the Info View is still in landscape mode from the device being in landscape. – MKDev Dec 13 '10 at 20:44
-
Interface orientation is an immutable property. I'm not sure you could do this the way you want to. I would design the view in interface builder the way you want it to look from landscape and load it as normal. – Kyle Dec 13 '10 at 21:12
1
Maybe something like this:
[application setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
-
I tried that before, The screen turns out like this though: http://img191.imageshack.us/img191/8808/screenshot20101213at200.png – MKDev Dec 13 '10 at 21:49
-
Looks like this is more complicated than it should have been... Take a look at this: http://stackoverflow.com/questions/181780/is-there-a-documented-way-to-set-the-iphone-orientation and you'll find a lot of ideas to play with. – IgorD Dec 13 '10 at 22:24