tags:

views:

668

answers:

2

Hi, I want to change the device orientation when a particular view appears. I got much information on the action to be taken when the orientation changes but I am not getting how do I change the device orientation itself programatically. Note that my other views must remain in the default orientation.

A: 

[[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait];

Note that this is not part of the UIDevice framework in the API documentation, so Apple may reject an application which uses this.

micco
+2  A: 

It worked for me. Will report back if/when apple rejects my app....

Update:

Thank you for submitting [app name] to the App Store. Unfortunately it cannot be added to the App Store because it is using a private API. Use of non-public APIs, which as outlined in the iPhone Developer Program License Agreement section 3.3.1 is prohibited:

"3.3.1 Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs."

The non-public API that is included in your application is setOrientation:.

got nate