I have more than ten ViewControllers in portrait mode, but I need to force a single one in Landscape mode regardless of the device′s orientation.
See Question&Answers more detail:osI have more than ten ViewControllers in portrait mode, but I need to force a single one in Landscape mode regardless of the device′s orientation.
See Question&Answers more detail:osHere is the solution:
1) Embed the LandscapeViewController in a subclassed NavigationController and connect it from your PortraitViewController using a modal segue.
2) Subclass UINavigationController
LandscapeNavigationController.m
-(BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeLeft;
}
3) Don't forget to dismiss your modal VC (in this case from my Bar Buttom Item Action)
- (IBAction)goBack:(id)sender
{
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}