1. 程式人生 > >iOS iPhone X適配

iOS iPhone X適配

IPhoneX 導航欄 狀態列 tabar高度

1.導航欄高度 88 非IPhoneX手機為64

2.狀態列高度 44 非IPhoneX手機為20

3.tabar高度 83 非IPhoneX手機為49  

 如下圖所示:

//判斷iPhone X
#define KIsiPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)

//狀態列高度
#define Height_StatusBar ((KIsiPhoneX==YES) ? 44.0f : 20.0f)
//導航欄高度
#define Height_NavBar    ((KIsiPhoneX==YES) ? 88.0f : 64.0f)
//tabbar高度
#define Height_TabBar    ((KIsiPhoneX==YES) ? 83.0f : 49.0f)