Created
May 7, 2014 21:16
-
-
Save coryhymel/b5b07baf37c71fef9022 to your computer and use it in GitHub Desktop.
Macros to check device types
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
#ifndef IS_WIDESCREEN | |
#define IS_WIDESCREEN (fabs((double)[[UIScreen mainScreen] bounds].size.height - (double)568) < DBL_EPSILON) | |
#endif | |
#ifndef IS_IPHONE | |
#define IS_IPHONE ([[[UIDevice currentDevice] model] isEqualToString:@"iPhone"]) | |
#endif | |
#ifndef IS_IPOD | |
#define IS_IPOD ([[[UIDevice currentDevice] model] isEqualToString:@"iPod touch"]) | |
#endif | |
#ifndef IS_IPAD | |
#define IS_IPAD ([[[UIDevice currentDevice] model] isEqualToString:@"iPad"]) | |
#endif | |
#ifndef IS_IPHONE5 | |
#define IS_IPHONE5 (IS_WIDESCREEN && IS_IPHONE) | |
#endif | |
#ifndef IS_IPOD5 | |
#define IS_IPOD5 (IS_WIDESCREEN && IS_IPOD) | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment