I have an app with one NavigationController and 4 UIViewController. I like to have 3 UIViewController in UIInterfaceOrientationPortrait and one in the Landscape mode. The Landscape Orientation should appear immediately, when the view appears. Unfortunately, the mode changes only when I turn the device. What can I do to change immediately to landscape without rotate the device?
Here is the code for my NavigationController.m
-(NSUInteger)supportedInterfaceOrientations
{
return [self.topViewController supportedInterfaceOrientations];
}
- (BOOL)shouldAutorotate
{
return [self.topViewController shouldAutorotate];
}
This is for the Portrait UIViewcontroller.m
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
And for the Landscape UIViewController.m :
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
// (iOS 6)
// Force to portrait
return UIInterfaceOrientationLandscapeRight;
}
In advance thanks for your help!