Created
December 14, 2012 02:26
-
-
Save sgrankin/4282046 to your computer and use it in GitHub Desktop.
iOS5/6 shouldAutorotateToInterfaceOrientation compatibility
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; | |
} | |
- (NSUInteger)supportedInterfaceOrientations | |
{ | |
return UIInterfaceOrientationMaskAllButUpsideDown; | |
} | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | |
{ | |
if ([self respondsToSelector:@selector(shouldAutorotate)] && | |
[self respondsToSelector:@selector(supportedInterfaceOrientations)]) { | |
// delegate to iOS6 compatible methods. | |
return [self shouldAutorotate] && ((1 << interfaceOrientation) & [self supportedInterfaceOrientations]); | |
} | |
else { | |
return [self shouldAutorotateToInterfaceOrientation:interfaceOrientation]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment