views:

77

answers:

3

Hi,

I have added a UIView as subview of my UIViewController, when I am trying change the orientation, it is not working, Please let me know how should i change the Interface orientation of my UIView?

Regards

Sri

A: 

try this..

[[UIDevice currentDevice] performSelector:@selector(setOrientation:) withObject:(id)UIInterfaceOrientationLandscapeRight];
Saurabh
A: 

Make sure you return YES for -shouldAutorotateToInterfaceOrientation: in your view controller.

jtbandes
A: 

Note that setOrientation is a private API according to the documentation of UIDevice (that property is read only). If you use it, your application will be rejected during the App Store review.

Instead forcing an orientation, you should override shouldAutorotateToInterfaceOrientation in all the view controllers of the hierarchy of that view and return YES only for the orientations you want to support.

Jano