Created
October 9, 2013 05:09
-
-
Save DougFischer/6896488 to your computer and use it in GitHub Desktop.
On iOS6+, the orientation of modal view controllers is handled by the view controller who present them. If you're using UITabBarController, it can be a little confusing, since you need to add presenting view controller some code to handle the modal controller's visibility. This code snippet shows how to have all UIViewControllers orientations (p…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - | |
#pragma mark UIApplication Delegate | |
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)pWindow { | |
UITabBarController *tabCtrl = (UITabBarController *)self.window.rootViewController; | |
//Check if there's a modal view controller on screen (dismissing modal view controllers are ignored) | |
if (tabCtrl.selectedViewController.presentedViewController && !tabCtrl.selectedViewController.presentedViewController.isBeingDismissed) { | |
return tabCtrl.selectedViewController.presentedViewController.supportedInterfaceOrientations; | |
} | |
return UIInterfaceOrientationMaskLandscape; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment