//弱引用
#define WeakSelf __weak typeof(self) wSelf = self;
// 獲取物理屏幕的寬度
#define KWidth? ? ? ? ? ? [[UIScreen mainScreen] bounds].size.width
#define KHeight? ? ? ? ? ? [[UIScreen mainScreen] bounds].size.height
//判斷數(shù)據(jù)
#define ObjectToString(obj) [NSString stringWithFormat:@"%@", [(obj) isKindOfClass:[NSNull class]] || !(obj) ? @"": (obj)]
#define ObjectToNumber(obj) ([(obj) isKindOfClass:[NSNull class]] || !(obj)) ? @(0) : ([(obj) respondsToSelector:@selector(floatValue)] ? @([(obj) floatValue]) : @(0))
#define ObjectToINT(obj) ([(obj) isKindOfClass:[NSNull class]] || !(obj)) ? @(0) : ([(obj) respondsToSelector:@selector(integerValue)] ? @([(obj) integerValue]) : @(0))
//全局顏色設(shè)置
#define DefaultColor UIColorFromRGB(0x1c83d5)
#define LineColor UIColorFromRGB(0xe0e0e0)
#define BgColor [UIColor groupTableViewBackgroundColor]? //背景色
//全局色
#define ThemeColor? UIColorFromRGB(0xfd8066)? //主題顏色
#define NavTitleColor UIColorFromRGB(0xffffff)? //導(dǎo)航欄標(biāo)題顏色
#define MainColor [UIColor colorWithRed:98.0/255.0green:110.0/255.0blue:127.0/255.0alpha:1.0]? ? //文字主色
#define ContentColor? UIColorFromRGB(0x8a98ae)? //內(nèi)容顏色
//導(dǎo)航欄高度
#define TopBarHeight? ? (([[UIApplication sharedApplication] statusBarFrame].size.height)+44)
//狀態(tài)欄高度
#define StatueBarHeight? ? ([[UIApplication sharedApplication] statusBarFrame].size.height)
//tabbar高度
#define TabbarHeight? ? ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49)// 適配iPhone x 底欄高度
//版本
#define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >=8.0f)
#define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >=9.0f)
#define iOS9_1Later ([UIDevice currentDevice].systemVersion.floatValue >=9.1f)
#define iOS10_1Later ([UIDevice currentDevice].systemVersion.floatValue >=10.0f)
#define iOS11_1Later ([UIDevice currentDevice].systemVersion.floatValue >=11.0f)
//隨機(jī)色宏
#define random(r, g, b, a) [UIColor colorWithRed:(r)/255.0green:(g)/255.0blue:(b)/255.0alpha:(a)/255.0]
#define RandomColor random(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue &0xFF0000) >>16))/255.0green:((float)((rgbValue &0xFF00) >>8))/255.0blue:((float)(rgbValue &0xFF))/255.0alpha:1.0]
#define ColorFromRGB_255(r, g, b, a) [UIColor colorWithRed:(float)r/255.0green:(float)g/255.0blue:(float)b/255.0alpha:a]
#define ColorFromRGB_1(r, g, b, a) [UIColor colorWithRed:(float)r green:(float)g blue:(float)b alpha:a]
//宏定義 字體大小 6p為1? 6及5s 0.9
#define IsIphone6P? ? ? ? ? KWidth ==414
#define SizeScale? ? ? ? ? (IsIphone6P ?1:0.9)
#define kFontSize(value)? ? value*SizeScale
#define kFont(value)? ? ? ? [UIFont systemFontOfSize:value*SizeScale]
//判斷是否是iPhone4s
#define IS_IPHONE4S (([[UIScreen mainScreen] bounds].size.height-480)?NO:YES)
//判斷是否是iPhone5
#define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES)
//判斷是否是iPhone6搓蚪、iPhone7
#define IS_IPHONE6 (([[UIScreen mainScreen] bounds].size.height-667)?NO:YES)
//判斷是否是iPhone6plush锻弓、7plus
#define IS_IPHONE6_PLUS (([[UIScreen mainScreen] bounds].size.height-736)?NO:YES)
#define Is_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125,2436), [[UIScreen mainScreen] currentMode].size) : NO)
//Appdelegate
#define APPDELEGATE (AppDelegate *)[[UIApplication sharedApplication] delegate]
//當(dāng)前設(shè)備的ios版本
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
// 在主線程中執(zhí)行
#define DO_IN_MAIN_QUEUE(action) dispatch_async(dispatch_get_main_queue(), action)
// 在主線程中延遲執(zhí)行
#define DO_IN_MAIN_QUEUE_AFTER(seconds, action) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, seconds * NSEC_PER_SEC), dispatch_get_main_queue(), action)
// 在子線程中執(zhí)行
#define DO_IN_BACKGROUND(action) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), action)
// 在子線程中延遲執(zhí)行
#define DO_IN_BACKGROUND_AFTER(seconds, action) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, seconds * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), action)
歡迎幫忙補(bǔ)充趟妥,謝謝柏腻!