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

    //获取屏幕 宽度、高度
    #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
    #define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

    //获取系统版本
    #define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
    #define CurrentSystemVersion [[UIDevice currentDevice] systemVersion]

    //获取当前语言
    #define CurrentLanguage ([[NSLocale preferredLanguages] objectAtIndex:0])

    //判断是否 Retina屏、设备是否%fhone 5、是否是iPad
    #define isRetina ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
    #define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
    #define isPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

    //判断是真机还是模拟器
    #if TARGET_OS_IPHONE
    //iPhone Device
    #endif

    #if TARGET_IPHONE_SIMULATOR
    //iPhone Simulator
    #endif

    //检查系统版本
    #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
    #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
    #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
    #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
    #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

    //读取本地图片
    #define LOADIMAGE(file,ext) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:file ofType:ext]]

    //定义UIImage对象
    #define IMAGE(A) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:A ofType:nil]]

    //带有RGBA的颜色设置
    #define COLOR(R, G, B, A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]

  • 相关阅读:
    Codeforces Round #632 (Div. 2)
    Educational Codeforces Round 83 E. Array Shrinking
    Codeforces Round #626 D. Present
    I
    java学习-get和post请求
    java学习-MD5消息摘要算法
    分销系统数据库设计
    java获得当前日期是今年的第几周,以及这周的开始日期的方法
    分销系统的用户关系,用户与推广链接的数据库设计。设计思路
    git工具,conflict冲突解决方法
  • 原文地址:https://www.cnblogs.com/S2-huai/p/3891581.html
Copyright © 2011-2022 走看看