zoukankan      html  css  js  c++  java
  • iOS 常用的宏

    /* -------- 屏幕宽高 -------- */

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

    #define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)

    /* -------- 打印日志 -------- */

    #ifdef DEBUG

    #define NSLog(FORMAT, ...) fprintf(stderr," %s:%d %s ",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String],__LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);

    #else

    #define NSLog(...)

    #endif

    /* -------- 系统版本 -------- */

    #define IS_IOS7  ( [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 )

    #define IS_IOS8  ( [[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 )

    #define IS_IOS9  ( [[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0 )

    /* -------- 颜色 -------- */

    #define UICOLOR_RGB(R, G, B, A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]

    #define UICOLOR_RANDOM  [UIColor colorWithRed:(arc4random()%255)/255.0 green:(arc4random()%255)/255.0 blue:(arc4random()%255)/255.0 alpha:1.0]

    /* -------- 真机模拟器 -------- */

    #if TARGET_OS_IPHONE

    // iPhone Device

    #endif

    #if TARGET_IPHONE_SIMULATOR

    // iPhone Simulator

    #endif

  • 相关阅读:
    正则表达式简介
    SQL 语言类型
    C# 与 SQL Server 的数据类型对应关系
    Visual Studio 各版本下载
    使用 Parallel LINQ 进行数据分页
    操作系统版本
    C# 命名规范
    解决chrome浏览器在win8下没有注册类的问题
    HttpClient的基本使用
    HttpClient介绍
  • 原文地址:https://www.cnblogs.com/chenyanliang/p/9679182.html
Copyright © 2011-2022 走看看