• 常用宏定义



    /** 是否iPad */
    #define isPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    
    /** 是否iPad */
    #define someThing (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)? ipad: iphone
    
    /** 获取系统版本 */
    #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)
    
    /** 判断设备的操做系统是不是ios7 */
    #define IOS7 ([[UIDevice currentDevice].systemVersion doubleValue] >= 7.0]
    
    /** 判断当前设备是不是iphone5 */
    #define kScreenIphone5 (([UIScreen mainScreen] bounds].size.height)>=568)
    
    /** 获取当前屏幕的高度 */
    #define CHScreenH ([UIScreen mainScreen].applicationFrame.size.height)
    /** 获取当前屏幕的宽度 */
    #define CHScreenW ([UIScreen mainScreen].applicationFrame.size.width)
    
    /** 定义一个define函数 */
    #define TT_RELEASE_CF_SAFELY(__REF) { if (nil != (__REF)) { CFRelease(__REF); __REF = nil; } }
    
    /** 判断是真机还是模拟器 */
    #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)
    
    
  • 相关阅读:
    数据库实例: STOREBOOK > 用户 > 编辑 用户: SYSTEM
    数据库实例: STOREBOOK > 用户 > 编辑 用户: SYSMAN
    数据库实例: STOREBOOK > 用户 > 编辑 用户: SYS
    [慢查优化]建索引时注意字段选择性 & 范围查询注意组合索引的字段顺序(转)
    面试常考知识
    TCP、UDP和HTTP详解
    TCP流量控制与拥塞控制
    主键与唯一性索引
    进程与线程的区别
    WEB中会话跟踪
  • 原文地址:https://www.cnblogs.com/CH520/p/9311248.html
Copyright © 2020-2023  润新知