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)

  • 相关阅读:
    递归 迷宫问题
    中缀表达式转后缀表达式
    栈实现后缀表达式计算

    单向环形链表
    站在巨人的肩上
    C#自宿主API,不依赖IIS
    MySQL 安装失败解决办法
    第一话
    村上春树《眠》读书笔记
  • 原文地址:https://www.cnblogs.com/huoran1120/p/5773520.html
Copyright © 2011-2022 走看看