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]

  • 相关阅读:
    Linux 分区注意事项
    wamp2.4-- 为WAMP中的mysql设置密码密码
    转multicast vs broadcast
    转 生成 HTMLTestRunner 测试报告
    Eclipse和PyDev搭建完美Python开发环境(Windows篇)
    转 深入解析浏览器的幕后工作原理
    selenium + python 怎样才能滚到页面的底部?
    Java ZIP压缩和解压缩文件(解决中文文件名乱码问题)
    Java中使用poi导入、导出Excel
    eclipse下的tomcat内存设置大小
  • 原文地址:https://www.cnblogs.com/S2-huai/p/3891581.html
Copyright © 2011-2022 走看看