Created
May 24, 2016 04:00
-
-
Save lengocgiang/8dd19491074cf3190f2bca346e422c38 to your computer and use it in GitHub Desktop.
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
#define RGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1] | |
#define HEXCOLOR(c) [UIColor colorWithRed:((float)((c & 0xFF0000) >> 16))/255.0 green:((float)((c & 0xFF00) >> 8))/255.0 blue:((float)(c & 0xFF))/255.0 alpha:1.0] | |
#define UIColorFromRGB(rgbValue) \ | |
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ | |
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \ | |
blue:((float)(rgbValue & 0xFF))/255.0 \ | |
alpha:1.0] | |
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) | |
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) | |
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0) | |
#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width) | |
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height) | |
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT)) | |
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT)) | |
#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0) | |
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0) | |
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0) | |
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0) | |
#define SYSTEM_VERSION ([[UIDevice currentDevice] systemVersion]) | |
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([SYSTEM_VERSION compare:v options:NSNumericSearch] != NSOrderedAscending) | |
#define IS_IOS8_OR_ABOVE (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) | |
#define IS_IOS7_OR_ABOVE (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) | |
#define IS_OS_7_OR_EALIER ([[[UIDevice currentDevice] systemVersion] floatValue] < 8.0) | |
#define SECOND 1 | |
#define MINUTE (60 * SECOND) | |
#define HOUR (60 * MINUTE) | |
#define DAY (24 * HOUR) | |
#define MONTH (30 * DAY) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment