iOS常用宏定义

https://github.com/HSFGitHub/CommonTools  
常用宏定义
        /**********************Color宏定义*************************/
        #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 HexRGB(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]
        //十六进位颜色转换(带alpha)
        #define HexRGBAlpha(rgbValue,a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:(a)]
        /*********************************************************/

        /************************字体*************************/
        #define MAIN_FONF_18      [UIFont systemFontOfSize:18]
        #define MAIN_FONF_17      [UIFont systemFontOfSize:17]
        #define MAIN_FONF_16      [UIFont systemFontOfSize:16]
        #define MAIN_FONF_15      [UIFont systemFontOfSize:15]
        #define MAIN_FONF_14      [UIFont systemFontOfSize:14]
        #define MAIN_FONF_13      [UIFont systemFontOfSize:13]
        #define MAIN_FONF_12      [UIFont systemFontOfSize:12]
        #define MAIN_FONF_11      [UIFont systemFontOfSize:11]
        #define MAIN_FONF_10      [UIFont systemFontOfSize:10]
        /****************************************************/

        /**************MBProgressHUD宏定义,弹出浮窗提示*************/
        //这个浮窗,需要配合MBProgressHUD使用,当有时再打开
        /*
         #define MBALERT(alertMsg) \
         dispatch_async(dispatch_get_main_queue(), ^{    \
         UIWindow *window=[UIApplication sharedApplication].keyWindow; \
         [MBProgressHUD hideAllHUDsForView:window animated:NO];\
         MBProgressHUD *ahud=[MBProgressHUD showHUDAddedTo:window animated:YES];\
         ahud.userInteractionEnabled = NO;\
         ahud.mode = MBProgressHUDModeText;\
         ahud.labelText = alertMsg;\
         [ahud hide:YES afterDelay:1];});
         */
        /*********************************************************/


        /**************************判断系统版本*************************/
        #define OSVersionIsAtLeastiOS6   ([[UIDevice currentDevice].systemVersion floatValue]>= 6.0 ? YES:NO)

        #define OSVersionIsAtLeastiOS7   ([[UIDevice currentDevice].systemVersion floatValue]>= 7.0 ? YES:NO)

        #define OSVersionIsAtLeastiOS8   ([[UIDevice currentDevice].systemVersion floatValue]>= 8.0 ? YES:NO)

        #define OSVersionIsAtLeastiOS9   ([[UIDevice currentDevice].systemVersion floatValue]>= 9.0 ? YES:NO)

        #define OSVersionIsAtLeastiOS10   ([[UIDevice currentDevice].systemVersion floatValue]>= 10.0 ? YES:NO)
        /*********************************************************/


        /***********屏幕的高度、宽度、关键keyWindow、导航栏*************/
        #define KEY_WINDOW  [[UIApplication sharedApplication]keyWindow]
        #define kScreenHeight CGRectGetHeight([[UIScreen mainScreen] bounds])
        #define kScreenWidth  CGRectGetWidth([[UIScreen mainScreen] bounds])
        #define NAVBARHEIGHT_STATUSBAR  (self.navigationController.navigationBar.frame.size.height + (OSVersionIsAtLeastiOS7?20:0))
        //iPhone4 4s机型
        #define ScreenInch4S (kScreenHeight < 568)
        #define ScreenLessThan375 (kScreenWidth < 375)

        /*********************************************************/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值