Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

arnieterm

macrumors regular
Original poster
Aug 28, 2008
201
0
Instead of designing [using IB or through code] a screen in landscape mode, how can we make a screen to always look in landscape mode even if the user rotates the iphone.
My problem is that with a touch on a button I have to show a screen in landscape and that screen needs to remain in landscape even if the iphone is rotated to left or right. There is another button on second screen that when touched by user will again take to first screen and in that case the screen needs to again come in the state in which it is originally.

With Regards
Parvez Qureshi
 

mars.tsang

macrumors newbie
Nov 25, 2008
12
0
The answer lies in the shouldAutorotateToInterfaceOrientation: method of your view controller.

first ,you should disable the autoratate ,that means you should Return false in the shouldAutorotateToInterfaceOrientation: method of your view controlle.
then ,you could use code like
[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated:NO];

[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeLeft animated:NO];

[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationPortrait animated:NO];

to make your iphone in landscape mode or back to portrait mode.
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
first ,you should disable the autoratate ,that means you should Return false in the shouldAutorotateToInterfaceOrientation: method of your view controlle.
then ,you could use code like
[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated:NO];

[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeLeft animated:NO];

[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationPortrait animated:NO];

to make your iphone in landscape mode or back to portrait mode.
That's only going to affect the statusBarOrientation and not anything else in the UI. There's a little more to what the OP wants, I believe.

arnieterm, I'd suggest you stop by my iPhone Programming Tutorial - Landscape-Only View-Based Application blog posting.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.