Created
October 16, 2012 18:35
-
-
Save cyborch/3901127 to your computer and use it in GitHub Desktop.
UIViewController snippet
This file contains hidden or 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
-(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