iOS 常用宏定义

2019-05-02  本文已影响0人  iOS_tree
//屏幕尺寸
#define kSCREEN_WIDTH    [UIScreen mainScreen].bounds.size.width
#define kSCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

//是否为iPhone X系列
#define  kIsiPhoneX (((ScreenWidth == 375.f && ScreenHeight == 812.f) || (ScreenWidth == 414.f && ScreenHeight == 896.f) || (ScreenHeight == 375.f && ScreenWidth == 812.f) || (ScreenHeight == 414.f && ScreenWidth == 896.f) || (ScreenHeight == 390.f && ScreenWidth == 844.f) || (ScreenHeight == 844.f && ScreenWidth == 390.f) || (ScreenHeight == 428.f && ScreenWidth == 926.f) || (ScreenHeight == 926.f && ScreenWidth == 428.f)) ? YES : NO)


/** 颜色*/
#define kESCRGBColor(r,g,b)  [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]
#define kESCRGBAColor(r,g,b,a)   [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
#define kESCRGB16Color(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]

#ifdef DEBUG
#   define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#   define DLog(...)
#endif
上一篇 下一篇

猜你喜欢

热点阅读