Created
June 14, 2014 12:52
-
-
Save justin/aafce8a85ee9b0595494 to your computer and use it in GitHub Desktop.
The old way of handling orientation and different devices
This file contains 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
UIDevice *device = [UIDevice currentDevice]; | |
UIDeviceOrientation currentOrientation = device.orientation; | |
BOOL isPhone = (device.userInterfaceIdiom == UIUserInterfaceIdiomPhone); | |
BOOL isTallPhone = ([[UIScreen mainScreen] bounds].size.height == 568.0); | |
if (UIDeviceOrientationIsPortrait(currentOrientation) == YES) | |
{ | |
// Do Portrait Things | |
if (isPhone == YES) | |
{ | |
// Do Portrait Phone Things | |
// Don't deny you've done this at least once. | |
if (isTallPhone) | |
{ | |
// iPhone 5+ | |
} | |
else | |
{ | |
// Old phones | |
} | |
} | |
else | |
{ | |
// Do Portrait iPad things. | |
} | |
} | |
else | |
{ | |
// Do Landscape Things. | |
if (isPhone == YES) | |
{ | |
// Do Landscape Phone Things | |
} | |
else | |
{ | |
// Do Landscape iPad things. | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment