iOS 常写在pch中的设备区分

释放双眼,带上耳机,听听看~!
#define INTERFACE_IS_PAD     ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)

#define INTERFACE_IS_PHONE   ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)




#define isOldPhone CGSizeEqualToSize(CGSizeMake(320,
480), [[UIScreen mainScreen] bounds].size)

#define isRetina4 (([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640,
960), [[UIScreen mainScreen] currentMode].size) : NO) || CGSizeEqualToSize(CGSizeMake(640,
960), [[UIScreen mainScreen] bounds].size))

#define isRetina5 (([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640,
1136), [[UIScreen mainScreen] currentMode].size) : NO) || CGSizeEqualToSize(CGSizeMake(640,
1136), [[UIScreen mainScreen] bounds].size))

#define isPad ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(768,
1024), [[UIScreen mainScreen] currentMode].size) : NO)

#define isRetinaPad ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(768*2,
1024*2), [[UIScreen mainScreen] currentMode].size) : NO)

#define isRetina6 (([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750,
1334), [[UIScreen mainScreen] currentMode].size) : NO))

#define isRetina6plus (([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242,
2208), [[UIScreen mainScreen] currentMode].size) : NO) || ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125,
2001), [[UIScreen mainScreen] currentMode].size) : NO))




#define IS_IOS7 (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1 && floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1)

#define IS_IOS8  ([[[UIDevice currentDevice] systemVersion] compare:@"8" options:NSNumericSearch] != NSOrderedAscending)

#define IS_IPHONE6PLUS ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) && [[UIScreen mainScreen] nativeScale] ==
3.0f)

// 是否模拟器

#define isSimulator (NSNotFound != [[[UIDevice currentDevice] model] rangeOfString:@"Simulator"].location)


 

人已赞赏
iOS文章

iOS 手势滑动返回功能

2020-4-30 23:33:02

iOS文章

iOS 蓝牙使用小结

2020-5-1 0:48:01

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索