• 常用的宏


    //获取屏幕 宽度、高度
    #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]

  • 相关阅读:
    【JavaWeb】Spring+SpringMVC+MyBatis+SpringSecurity+EhCache+JCaptcha 完整Web基础框架(前言)
    【CityHunter】游戏流程设计及技术要点
    lua table操作
    python线程池(转)
    windows通过企业内部授权服务器激活方法
    贝叶斯定理(转)
    python 日期计算
    python 过滤 b'及提取 cmd命令返回值
    python 连接MySQL数据库
    python 获取昨天的日期
  • 原文地址:https://www.cnblogs.com/S2-huai/p/3891581.html
Copyright © 2020-2023  润新知