Ok, here it is. kinda complicated.
Project Settings must allow P, LL & LR
Storyboard is a UINavController
with a UITableViewController
with a push bar button segue to a UIViewController
.
All scenes in storyboard must have inferred as orientation in simulated metrics. Just saying, cause after a while i had them all with different settings after testing so much.
Must have a Class for NavController
, TableViewController
and the given UIVController
. My app started out as Single view, then I dragged in a UITVC and finally embedded the UITVC in a UINVC. Then I connected the UIVC to the UITVC bar button item I dragged in via push segue.
Set apps window.rootvc
to the navVC
, your top hierarchy vc (don't forget to set that ID in storyboards or it'll crash of course):
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
UINavigationController *myNavC = (UINavigationController*)[mainStoryboard instantiateViewControllerWithIdentifier:@"MainNav"];
self.window.rootViewController = myNavC;
Tell big boss UINVC everyone can rotate:
- (BOOL)shouldAutorotate {
return self.topViewController.shouldAutorotate;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return self.topViewController.supportedInterfaceOrientations;
}
Restrict tablevc so it won't rotate:
- (BOOL)shouldAutorotate { return NO; }
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return (UIInterfaceOrientationMaskPortrait);
}
Allow last UIVC to rotate:
- (BOOL)shouldAutorotate { return YES; }
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return (UIInterfaceOrientationMaskAllButUpsideDown);
}