Skip to content

Instantly share code, notes, and snippets.

@i03nomura1y
Created February 27, 2013 08:30
Show Gist options
  • Save i03nomura1y/5046305 to your computer and use it in GitHub Desktop.
Save i03nomura1y/5046305 to your computer and use it in GitHub Desktop.
UINavigationController addition for autorotate
#define SPIN_ENABLE 1
@implementation UINavigationController(my)
- (BOOL)shouldAutorotate{
#if SPIN_ENABLE
return YES;
#else
return NO;
#endif
}
- (NSUInteger)supportedInterfaceOrientations{
return [self.viewControllers.lastObject supportedInterfaceOrientations];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
#if SPIN_ENABLE
return [self.viewControllers.lastObject shouldAutorotateToInterfaceOrientation:toInterfaceOrientation];
#else
return NO;
#endif
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment