NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft]; [[UIDevice currentDevice] setValue:value forKey:@"orientation"];
Just call - viewDidAppear: submitted view controller.
Another way:
First, you must understand that in order to open at least one view of more than 100 in the landscape, your application must support landscape orientation and portfolio. This is the default, but you can check it in your target settings, General tab, Deployment Details section
Then, since you have allowed both landscape and portrait for the entire application, you will only need to tell the portrait — only the UIViewController — that it should not be autorotated by adding this implementation of the method: -
- (BOOL)shouldAutorotate { return NO; }
Finally, for your specific controller only for the landscape, and since you said that you represented it as a modality, you can simply implement these methods: -
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationLandscapeLeft; // or Right of course } -(UIInterfaceOrientationMask)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; }
Hope this helps :)
source share