Skip to content

Instantly share code, notes, and snippets.

@r-dent
Last active August 29, 2015 14:20
Show Gist options
  • Save r-dent/4b50da5a52bd7d083153 to your computer and use it in GitHub Desktop.
Save r-dent/4b50da5a52bd7d083153 to your computer and use it in GitHub Desktop.
iOS Macros
#define IS_iOS_8 [[[UIDevice currentDevice] systemVersion] hasPrefix:@"8"]
#define IS_iPad UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IPHONE_4S_AND_LOWER (IS_IPHONE && MAX([UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width) == 480.0)
#define IS_IPHONE_5 (IS_IPHONE && MAX([UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width) == 568.0)
#define IS_iPhone6 (IS_IPHONE && MAX([UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width) == 667)
#define IS_iPhone6Plus (IS_IPHONE && MAX([UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width) == 736)
#define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment