根据屏幕大小判断是否是刘海屏系列手机,目前市场上刘海屏手机有,IPhoneX, IPhoneXS Max, IPhoneXS,IPhoneXR四款,
之所以要用到min函数和max函数,主要为了避免横屏竖屏。
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IOS_11 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.f)
#define IS_IPHONE_X (IS_IOS_11 && IS_IPHONE && (MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) >= 375 && MAX([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) >= 812))
网友评论