zoukankan      html  css  js  c++  java
  • 自己常用的宏(遇到添加)

    1.屏幕宽度屏幕高度

    #define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width

    #define SCREENH_HEIGHT [UIScreen mainScreen].bounds.size.height

    2.获取随机颜色

    #define RRRandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]

    3.颜色

    #define RRColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]

    #define RRALPHAColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(r)/255.0 blue:(r)/255.0 alpha:a]

    #define RRClearColor [UIColor clearColor]

    4.Log

    RRLog(...) NSLog(@"%s 第%d行 %@ ",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])

    5.判空

    //是否为空或是[NSNull null]

    #define NotNilAndNull(_ref) (((_ref) != nil) && (![(_ref) isEqual:[NSNull null]]))

    #define IsNilOrNull(_ref) (((_ref) == nil) || ([(_ref) isEqual:[NSNull null]]))

    //字符串是否为空

    #define IsStrEmpty(_ref) (((_ref) == nil) || ([(_ref) isEqual:[NSNull null]]) ||([(_ref)isEqualToString:@""]) ||([(_ref)isEqualToString:@"(null)"]))

    //数组是否为空

    #define IsArrEmpty(_ref) (((_ref) == nil) || ([(_ref) isEqual:[NSNull null]]) ||([(_ref) count] == 0))

    #define IsNumberEmpty(_ref) ((_ref) == nil) || ((_ref).floatValue == 0)

  • 相关阅读:
    php中file_get_contents的图片乱码
    Lsh and Rsh (左移和右移)
    |=的含义
    Intercultural Communication Drama
    VS代码块快速折叠快捷键
    C++sqrt()函数与sqrtf()函数的区别
    C++中union和struct之间的区别
    泛型编程
    生成百度网盘目录文件
    字符串前L的含义
  • 原文地址:https://www.cnblogs.com/huoran1120/p/5773520.html
Copyright © 2011-2022 走看看