2 different storyboards for portrait and landscape
-
10-12-2019 - |
Question
is it possible to create 2 storyboards and access each of them depending on the device orientation? I tried this code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
if (UIInterfaceOrientationPortrait){
UIStoryboard *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"Storyboardland.storyboard"];
}else if (UIInterfaceOrientationPortraitUpsideDown){
UIStoryboard *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"MainStoryboard_iPad.storyboard"];
}}
...but does not work?? Any errors I am making??
Solution
I think this answer to a previous post (iPhone Storyboard: different scene for portrait and landscape) might solve your problem. It explains how to have a different views for portrait and landscape modes, but still uses the same view controller.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow