美文网首页
iOS 常用宏定义

iOS 常用宏定义

作者: iOS_tree | 来源:发表于2019-05-02 13:11 被阅读0次
    //屏幕尺寸
    #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
    

    相关文章

      网友评论

          本文标题:iOS 常用宏定义

          本文链接:https://www.haomeiwen.com/subject/oudnnqtx.html