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)

  • 相关阅读:
    javascript学习6
    javascript学习5
    javascript学习4
    javaccript学习3
    javaccript学习2
    javaccript学习1
    C++ 线性表实现
    深入解析策略模式(转)
    CentOS7安装MySQL
    万能媒体播放器 PotPlayer
  • 原文地址:https://www.cnblogs.com/huoran1120/p/5773520.html
Copyright © 2011-2022 走看看