Skip to content

Instantly share code, notes, and snippets.

@coryhymel
Created May 7, 2014 21:16
Show Gist options
  • Save coryhymel/b5b07baf37c71fef9022 to your computer and use it in GitHub Desktop.
Save coryhymel/b5b07baf37c71fef9022 to your computer and use it in GitHub Desktop.
Macros to check device types
#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