Skip to content

Instantly share code, notes, and snippets.

@andkon
Last active August 29, 2015 14:15
Show Gist options
  • Save andkon/6fd173142a8b8391885a to your computer and use it in GitHub Desktop.
Save andkon/6fd173142a8b8391885a to your computer and use it in GitHub Desktop.
iPhone screen size macros
// http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices
#define IS_IPHONE ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPhone" ] )
#define IS_IPHONE_4 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )480 ) < DBL_EPSILON )
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
#define IS_IPHONE_6 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )667 ) < DBL_EPSILON )
#define IS_IPHONE_6_PLUS ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )736 ) < DBL_EPSILON )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment