Created
November 2, 2012 14:13
-
-
Save mcgaffin/4001580 to your computer and use it in GitHub Desktop.
Here's how you implement autorotate conditionally when your view is in a UINavigationController
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
// This is inside a subclass of UINavigationController that has been set as the root view of the app. | |
- (BOOL)shouldAutorotate | |
{ | |
if ([self.topViewController isKindOfClass:[DetailViewController class]]) { | |
return [self.topViewController shouldAutorotate]; | |
} | |
return NO; | |
} | |
- (NSUInteger)supportedInterfaceOrientations | |
{ | |
if ([self.topViewController isKindOfClass:[DetailViewController class]]) { | |
return [self.topViewController supportedInterfaceOrientations]; | |
} | |
return UIInterfaceOrientationMaskPortrait; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment