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

  • 相关阅读:
    缓存
    java内存模型—先行发生原则
    Java中的阻塞队列
    java的Map
    事务传播性、隔离性与MVCC
    final修饰符
    领域驱动设计和实践
    对象转换利器之Dozer
    SharePoint Iframe 报错“此内容不能显示在一个框架中”
    使用SVG symbols建立图标系统
  • 原文地址:https://www.cnblogs.com/chenyanliang/p/9679182.html
Copyright © 2011-2022 走看看