Tutorial :Make UIView Landscape Orientation in UIViewController?



Question:

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


Solution:1

try this..

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


Solution:2

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


Solution:3

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »