美文网首页
Prefix常用设置

Prefix常用设置

作者: 微小的沙土 | 来源:发表于2020-04-23 17:04 被阅读0次
    #import "NSString+Zy.h"
    #import "UIColor+Extension.h"
    
    // screen
    #define KScreenWidth                MIN([UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height)
    #define KScreenHeight               MAX([UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height)
    
    #define rectStatus  [[UIApplication sharedApplication] statusBarFrame]
    #define KStatusH    CGRectGetHeight(rectStatus) //状态栏高度
    #define KNavBarH    (iPhoneX || iPhone11 ? 88.f : 64.f)//导航高度 (包括状态栏)
    #define KTabBarH    (iPhoneX || iPhone11 ? 83.f : 49.f) //底部 选项卡高度
    
    // iPhone
    #define iPhone   (KScreenWidth == 320.0f && KScreenHeight == 480.0f)  // 3GS/4/4s
    #define iPhoneSE (KScreenWidth == 320.0f && KScreenHeight == 568.0f)  // 5/5s/5c
    
    #define iPhone6  (KScreenWidth == 375.0f && KScreenHeight == 667.0f)  // 6/6s
    #define iPhone6P (KScreenWidth == 414.0f && KScreenHeight == 736.0f)  // 6p/6sP
    
    #define iPhoneX  (KScreenWidth == 375.0f && KScreenHeight == 812.0f)  // X/XS/Pro
    #define iPhone11 (KScreenWidth == 414.0f && KScreenHeight == 896.0f)  // 11/XR/Max
    
    
    //system
    #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
    
    #define IOS11           ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 11.0)
    #define IOS10Lower      ([[[UIDevice currentDevice] systemVersion] doubleValue] < 10.0)
    
    // color
    #define BaseColor                   RGB(146,40,40)
    #define BaseColorLight              RGB(254,236,212)
    #define BaseColorDark               RGB(125,28,28)
    
    #define SameColor(c)                RGB(c,c,c)
    #define LineColor                   SameColor(230)
    #define PlaceholderColor            SameColor(191)
    #define BGColor                     SameColor(240)
    
    #define RGBA(r,g,b,a)               [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
    #define RGB(r,g,b)                  RGBA(r,g,b,1.0f)
    #define HEXColor(colorString)       [UIColor colorWithHexString:colorString]
    #define MultiColor                  RGBA(arc4random()%255,arc4random()%255,arc4random()%255,1.0f)
    
    
    // block
    #if __has_feature(objc_arc) //ARC
    #define WeakSelf             __weak typeof(self) weakSelf = self;
    #define WeakVC(vc)           __weak typeof(vc) weakVC = vc;
    #else //MRC
    #define WeakSelf             __block typeof(self) weakSelf = self;
    #define WeakController(vc)   __block typeof(vc) weakVC = vc;
    #endif
    
    
    // log
    #if DEBUG
    #define NSLog(...)                  NSLog(__VA_ARGS__);
    #define DLog(fmt, ...)              NSLog((@"%s""(%d)\n\t" fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__);
    
    #define LRString                    [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent
    #define LRLog(...)                  printf("%s: %s 第%d行: %s\n\n",[[NSString timeLogString] UTF8String], [LRString UTF8String] ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String]);
    static BOOL const isRelease = NO;
    #else
    #define NSLog(...)
    #define DLog(...)
    #define LRLog(...)
    static BOOL const isRelease = YES;
    #endif
    

    相关文章

      网友评论

          本文标题:Prefix常用设置

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