// 懒加载
#define HT_LAZY(object, assignment) (object = object ?: assignment)
// 返回一个字符串
#define stringify __STRING
// 设置颜色
#define SetColor(r, g, b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1.0f]
#define SetAColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
// 设置字体
#define SetFont(fontName,font) [UIFont fontWithName:(fontName) size:(font)]
// 获取屏幕宽度,高度
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
// 判断是否是X系列
#define IS_IPHONEX \
({\
BOOL iPhoneXSeries = NO;\
if (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPhone) { \
(iPhoneXSeries); \
} \
if (@available(iOS 11.0, *)) { \
UIWindow *mainWindow = [[[UIApplication sharedApplication] delegate] window]; \
if (mainWindow.safeAreaInsets.bottom > 0.0) { \
iPhoneXSeries = YES; \
} \
} \
(iPhoneXSeries); \
}) \
#define Height (IS_IPHONEX ? ([[UIScreen mainScreen] bounds].size.height-20):([[UIScreen mainScreen] bounds].size.height))
//判断编译环境
#if DEBUG
#define kBaseImageURL @""
#else
#define kBaseImageURL @""
#endif
网友评论