常用宏定义 - 系统相关
生活随笔
收集整理的這篇文章主要介紹了
常用宏定义 - 系统相关
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
/** 是否iPad */ #define isPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)/** 是否iPad */ #define someThing (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)? ipad: iphone/** 獲取系統(tǒng)版本 */ #define IOS_VERSION [[UIDevice currentDevice] systemVersion] floatValue] #define CurrentSystemVersion [UIDevice currentDevice] systemVersion]/** 獲取當(dāng)前語言 */ #define CurrentLanguage ([NSLocale preferredLanguages] objectAtIndex:0])/** 判斷是否 Retina屏、設(shè)備是否%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)/** 判斷設(shè)備的操做系統(tǒng)是不是ios7 */ #define IOS7 ([[UIDevice currentDevice].systemVersion doubleValue] >= 7.0]/** 判斷當(dāng)前設(shè)備是不是iphone5 */ #define kScreenIphone5 (([UIScreen mainScreen] bounds].size.height)>=568)/** 獲取當(dāng)前屏幕的高度 */ #define CHScreenH ([UIScreen mainScreen].applicationFrame.size.height) /** 獲取當(dāng)前屏幕的寬度 */ #define CHScreenW ([UIScreen mainScreen].applicationFrame.size.width)/** 定義一個define函數(shù) */ #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/** 檢查系統(tǒng)版本 */ #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)
轉(zhuǎn)載于:https://www.cnblogs.com/CH520/p/9311248.html
總結(jié)
以上是生活随笔為你收集整理的常用宏定义 - 系统相关的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: traceping是什么意思_trace
- 下一篇: 删除弹框提示_如何关闭Mac的Micro