屏幕尺寸:375x812
(可以根据这个812判断是否是iPhone X)
导航栏:88
标签栏:83
//-----------------安全高度、导航栏高度、标签栏高度---------------------适配iPhone X
#define Nav_Start_Y (kScreenHeight == 812 ? 24 : 0)
#define Nav_Height (kScreenHeight == 812 ? 88 : 64)
#define TabBar_Height (kScreenHeight == 812 ? 83 : 49)
#define GGStatusView (kScreenHeight == 812 ? 34.0 : 20.0)
举个例子哈:
// 创建假的导航栏
navBar = [MainNavigationBar viewFromXIB];
navBar.frame = CGRectMake(0, 0, SCREEN_WIDTH, Nav_Height);
[self.view addSubview:navBar];