都是挺常见的宏的应用,就不再一一注释了,权当做自己的一个笔记好了。
#define APP [UIApplication sharedApplication]
#define APP_KEYWINDOW [UIApplication sharedApplication].keyWindow
#define HOME [TabBarControllerConfig Instance]
#define DeviceBounds [UIScreen mainScreen].bounds
#define DeviceBounds_WIDTH [UIScreen mainScreen].bounds.size.width
#define DeviceBounds_HEIGHT [UIScreen mainScreen].bounds.size.height
#define SCREEN_W DeviceBounds_WIDTH
#define SCREEN_H DeviceBounds_HEIGHT
#define IOS_35_SCREEN [[UIScreen mainScreen] bounds].size.height <= 480.0//320*480
#define IOS_4_SCREEN [[UIScreen mainScreen] bounds].size.height > 480.0 && [[UIScreen mainScreen] bounds].size.height < 600.0//320*568
#define IOS_47_SCREEN [[UIScreen mainScreen] bounds].size.height > 600.0 && [[UIScreen mainScreen] bounds].size.height < 700.0//375*667
#define IOS_55_SCREEN [[UIScreen mainScreen] bounds].size.height > 700.0//414*736
#define DEVICE_PHONE ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
#define DEVICE_PAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#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 UIColorFromRGBWithAlpha(rgbValue,alphaValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:alphaValue]
#endif
#define LS(str) NSLocalizedString(str, nil)
#define SUBFIX(str) ([NSString stringWithFormat:@"%@%@",[self class],str])
#define StrFromInt(int) ([NSString stringWithFormat:@"%d",int])
#define StrFromLong(long) ([NSString stringWithFormat:@"%ld",long])
#define StrFromLonglong(longlong) ([NSString stringWithFormat:@"%lld",longlong])
#define StrFromFloat(float) ([NSString stringWithFormat:@"%f",float])
#ifdef DEBUG
#define NSLog(...) NSLog(__VA_ARGS__)
#define DLog(fmt,...) NSLog((@"%@ [line %u]: " fmt), NSStringFromClass(self.class), __LINE__, ##__VA_ARGS__)
#else
#define NSLog(...)
#define DLog(...)