PrefixHeader中的一些内容

//弱引用

#define WeakSelf __weak typeof(self) wSelf = self;

// 获取物理屏幕的宽度

#define KWidth            [[UIScreen mainScreen] bounds].size.width

#define KHeight            [[UIScreen mainScreen] bounds].size.height

//判断数据

#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))

//全局颜色设置

#define DefaultColor UIColorFromRGB(0x1c83d5)

#define LineColor UIColorFromRGB(0xe0e0e0)

#define BgColor [UIColor groupTableViewBackgroundColor]  //背景色

//全局色

#define ThemeColor  UIColorFromRGB(0xfd8066)  //主题颜色

#define NavTitleColor UIColorFromRGB(0xffffff)  //导航栏标题颜色

#define MainColor [UIColor colorWithRed:98.0/255.0green:110.0/255.0blue:127.0/255.0alpha:1.0]    //文字主色

#define ContentColor  UIColorFromRGB(0x8a98ae)  //内容颜色

//导航栏高度

#define TopBarHeight    (([[UIApplication sharedApplication] statusBarFrame].size.height)+44)

//状态栏高度

#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)

//随机色宏

#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]

//当前设备的ios版本

#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

// 在主线程中执行

#define DO_IN_MAIN_QUEUE(action) dispatch_async(dispatch_get_main_queue(), action)

// 在主线程中延迟执行

#define DO_IN_MAIN_QUEUE_AFTER(seconds, action) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, seconds * NSEC_PER_SEC), dispatch_get_main_queue(), action)

// 在子线程中执行

#define DO_IN_BACKGROUND(action) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), action)

// 在子线程中延迟执行

#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)



欢迎帮忙补充,谢谢!

你可能感兴趣的:(PrefixHeader中的一些内容)