// .pch 文件中写
// 判断是iPhone机型
/*
4s 960 * 640
5/5s 1136 x 640
6/6s/7/8 4.7英寸 1334 x 750
6p/6sp/7p/8p 5.5英寸 1920 x 1080
-
X 5.8英寸 2436 x 1125
}
*/#define IS_IPHONE_4s [UIScreen instancesRespondToSelector:@selector(currentMode)] ? \ CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : \ NO #define IS_IPHONE_5s [UIScreen instancesRespondToSelector:@selector(currentMode)] ? \ CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : \ NO #define IS_IPHONE_6s [UIScreen instancesRespondToSelector:@selector(currentMode)] ? \ CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : \ NO #define IS_IPHONE_6sp [UIScreen instancesRespondToSelector:@selector(currentMode)] ? \ CGSizeEqualToSize(CGSizeMake(1080, 1920), [[UIScreen mainScreen] currentMode].size) : \ NO #define IS_IPHONE_X [UIScreen instancesRespondToSelector:@selector(currentMode)] ? \ CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : \ NO #define IS_IPHONE_X [UIScreen instancesRespondToSelector:@selector(currentMode)] ? \ CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : \ NO
// 上面的表达方式和下面的一样,都是用的三目运算符,只是没有加行尾的“\”
#define IS_IPHONE_X [UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO