Skip to content

Instantly share code, notes, and snippets.

@mcgaffin
Created November 2, 2012 14:13
Show Gist options
  • Save mcgaffin/4001580 to your computer and use it in GitHub Desktop.
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 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