常用的宏:
//定义屏幕高度
#define ScreenHeight [UIScreen mainScreen].bounds.size.height
//定义屏幕宽度
#define ScreenWidth [UIScreen mainScreen].bounds.size.width
//定义屏幕分辨率
#define ScreenScale [UIScreen mainScreen].bounds.size.width / 320
//判断是否是4寸屏
#define IS4InchScreen (([[UIScreen mainScreen] bounds].size.height == 568) ? YES : NO)
//判断是否3.5寸屏
#define IS35InchScreen ([[UIScreen mainScreen] bounds].size.height < 568)
//判断是否4.7寸屏
#define IS47InchScreen (([[UIScreen mainScreen] bounds].size.height == 667) ? YES : NO)
//判断是否5.5寸屏
#define IS55InchScreen (([[UIScreen mainScreen] bounds].size.height == 736) ? YES : NO)
//Tabbar高度
#define TAB_BAR_HEIGHT 49
//Nav高度
#define NAV_BAR_HEIGHT 44
//iphoneX的设备
#define IPhoneX (ScreenWidth == 375.f && ScreenHeight == 812.f ? YES : NO)
#define STATUS_BAR_HEIGHT (IPhoneX ? 44 : 20)
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
例如:SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"9.0")
//h文件
#define ShareInstance_Interface(var) + (instancetype)shareInstance;
//m文件
#define ShareInstance_Implementation(var) \
+(instancetype)shareInstance{\
static var instance; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
if (!instance) {\
instance = [[var alloc] init];\
}\
}\
return instance;\
}\