Created
June 22, 2015 05:10
-
-
Save fahied/27da57d40a5805fe4535 to your computer and use it in GitHub Desktop.
iOS Useful Macros
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
// Constants | |
#define APP_VERSION [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"] | |
#define APP_NAME [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"] | |
#define APP_DELEGATE [[UIApplication sharedApplication] delegate] | |
#define USER_DEFAULTS [NSUserDefaults standardUserDefaults] | |
#define APPLICATION [UIApplication sharedApplication] | |
#define BUNDLE [NSBundle mainBundle] | |
#define MAIN_SCREEN [UIScreen mainScreen] | |
#define DOCUMENTS_DIR [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject] | |
#define IS_PAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) | |
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON ) | |
// Props | |
#define ScreenWidth [MAIN_SCREEN bounds].size.width | |
#define ScreenHeight [MAIN_SCREEN bounds].size.height |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment