tags:

views:

383

answers:

3

How to change orientation to landscape on button event

+1  A: 

I found this online:

application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;

There is also an event which is triggered when you change the orientation of the phone where you specify the allowed mode (portrait or landscape).

Hope that helps.

Littlejon
thanks, But I want to put abutton on navigation bar to change the orientation to landscape. Is tere any way to do so ?
nic
I haven't tried it but the application.statusBarOrientation seems like it could do the trick. You will need to create an event for the nav bar button push then put this code in.
Littlejon
http://iphonesdkdev.blogspot.com/2008/08/how-to-force-orientation-to-landscape.html
Littlejon
Of course, you need to have declared an `application` variable and set it to `[UIApplication sharedApplication]` for the above code sample to work. If you were only using this once, you could use `[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];`.
Steve Harrison
...or `[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;` if you prefer dot-notation syntax...
Steve Harrison
A: 

Take a look here: strange.bplaced.net

strange99
A: 

How can I say thanks to the author of strange.bplaced.net :D ! He did it excellently .

Tu
Use comments if you don't have an actual answer (like this). That's how.
bradhouse