// // ZCCommon.h // XLChat // // Created by 张灿 on 2017/10/24. // Copyright © 2017年 张灿. All rights reserved. // #ifndef ZCCommon_h #define ZCCommon_h #import "UIColor+YYAdd.h" #import "YOUPAILZMusicManager.h" #import "YOUPAILZChatRoomManager.h" #import "YOUPAILZIntimateManager.h" #import "ZCCategory.h" #import "ZCBaseVC.h" #import "ZCBaseWebVC.h" #import "ZCBaseNavigationVC.h" #import "ZCHUDHelper.h" #import "ZCRegularHelper.h" #import "ZCAlertSheetView.h" #import "ZCAlertSheetBtnView.h" #import "ZCShareSheetView.h" #import "ZCLiveTextView.h" #import "ZCNavMenuView.h" #import "ZCUtils.h" #import "SDWebImageManager.h" #import "UIImageView+WebCache.h" #import "UIButton+WebCache.h" // 屏幕尺寸 #define kScreenBounds [UIScreen mainScreen].bounds #define kFrameWidth [UIScreen mainScreen].bounds.size.width #define kFrameHeight [UIScreen mainScreen].bounds.size.height ////屏幕系数 //#define ScreenWidthCoefficientWith(pram) ((kFrameWidth - pram) / (375 - pram)) //#define PopularScreenWidthCoefficientWith(pram) ((kFrameWidth - pram) / (360 - pram)) #define ConstWidth 375.0f //屏幕系数常数 、UI图的标准尺寸 #define ConstHeight 812.0f //屏幕系数常数 、UI图的标准尺寸 #define KScreenEqualWidth(x) (x/ConstWidth*kFrameWidth) #define KScreenEqualHeight(y) (y/ConstHeight*kFrameHeight) //苹方-简 常规体 //font-family: PingFangSC-Regular, sans-serif; #define QHFontPingFangRegular(font) [UIFont fontWithName:@"PingFangSC-Regular" size: font] // //苹方-简 极细体 //font-family: PingFangSC-Ultralight, sans-serif; #define QHFontPingFangUltraligh(font) [UIFont fontWithName:@"PingFangSC-Ultralight" size: font] //苹方-简 细体 //font-family: PingFangSC-Light, sans-serif; #define QHFontPingFangLight(font) [UIFont fontWithName:@"PingFangSC-Light" size: font] //苹方-简 纤细体 //font-family: PingFangSC-Thin, sans-serif; #define QHFontPingFangThin(font) [UIFont fontWithName:@"PingFangSC-Thin" size: font] //苹方-简 中黑体 //font-family: PingFangSC-Medium, sans-serif; #define QHFontPingFangMedium(font) [UIFont fontWithName:@"PingFangSC-Medium" size: font] //苹方-简 中粗体 //font-family: PingFangSC-Semibold, sans-serif; #define QHFontPingFangSemibold(font) [UIFont fontWithName:@"PingFangSC-Semibold" size: font] //判断屏幕尺寸 #define IS_IPHONE_4 ([[UIScreen mainScreen]bounds].size.height == 480.0) #define IS_IPHONE_5 ([[UIScreen mainScreen]bounds].size.height == 568.0) #define IS_IPHONE_6 ([[UIScreen mainScreen]bounds].size.height == 667.0) #define IS_IPHONE_6P ([[UIScreen mainScreen]bounds].size.height == 736.0) //系统版本大于等于 #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) #define IOS10 ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 10.0) #define IOS9 ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 9.0) //获取屏幕宽度 #define KScreenWidth [UIScreen mainScreen].bounds.size.width #define ConstWidth 375.0f //屏幕系数常数 、UI图的标准尺寸 #define ConstHeight 812.0f //屏幕系数常数 、UI图的标准尺寸 #define WHScreenEqualWidth(x) (x/ConstWidth*kFrameWidth) #define WHScreenEqualHeight(y) (y/ConstHeight*kFrameHeight) //获取屏幕高度 #define KScreenHeight [UIScreen mainScreen].bounds.size.height #define StatusBarHeight ([LCTools getStatusBarHight] == 0 ? (Is_iPhoneX ? 44 : 20) : [LCTools getStatusBarHight])//(Is_iPhoneX ? 44 : 20) #define NavBarHeight ([LCTools getStatusBarHight] + 44.0f) #define TabbarHeight (Is_iPhoneX ? (49.f+34.f) : 49.f) #define SafeHeight (Is_iPhoneX ? 34.f: 0) #define ScaleSize(value) ((KScreenWidth/375.0f) * value) #define ScaleHeight(value) ((KScreenHeight/667) * value) #define isIphoneX_XS (KScreenWidth == 375.f && KScreenHeight == 812.f ? YES : NO) #define isIphoneXR_XSMax (KScreenWidth == 414.f && KScreenHeight == 896.f ? YES : NO) #define Is_iPhoneX (isIphoneX_XS || isIphoneXR_XSMax) //#define Is_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) //十六进制颜色表示 #define kColors(str) ([UIColor colorWithHexString:str]) #define HexColorFromRGB(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 HexColorFromRGBA(rgbValue,a) [UIColor \ colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \ blue:((float)(rgbValue & 0xFF))/255.0 alpha:a] //十进制颜色表示 #define DecColorFromRGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0] #define DecColorFromRGBA(r, g, b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a] //文件路径 #define DocumentPath ([NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]) //Caches目录路径 #define CachesPath ([NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject]) // 弱引用 强引用 #define WeakSelf __weak __typeof(self)weakSelf = self #define StrongSelf __strong __typeof(weakSelf)strongSelf = weakSelf #endif /* ZCCommon_h */