Skip to content

Instantly share code, notes, and snippets.

@cyborch
Created October 16, 2012 18:35
Show Gist options
  • Save cyborch/3901127 to your computer and use it in GitHub Desktop.
Save cyborch/3901127 to your computer and use it in GitHub Desktop.
UIViewController snippet
-(BOOL)shouldAutorotate {
return YES;
}
-(NSInteger)supportedInterfaceOrientations {
// For some reason this is implemented in iOS5 but I have to do it myself in iOS6.
UIInterfaceOrientationMask mask = 0;
if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationPortrait])
mask |= UIInterfaceOrientationMaskPortrait;
if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationLandscapeLeft])
mask |= UIInterfaceOrientationMaskLandscapeLeft;
if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationLandscapeRight])
mask |= UIInterfaceOrientationMaskLandscapeRight;
if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationPortraitUpsideDown])
mask |= UIInterfaceOrientationMaskPortraitUpsideDown;
return mask;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment