在你的pch文件中加上下面的代码就可以了 define IS_IPhoneX_All ([UIScreen mainScreen].bounds.size.height == 812 || [UIScreen mainScreen].bounds.size.height == 896) //状态栏、导航栏、标签栏高度 define Height_StatusBar (IS_IPhoneX_All ? 44.0f:20.0f) define Height_LIUHAI (IS_IPhoneX_All ? 24 : 0) define Height_NavBar (IS_IPhoneX_All ? 88 : 64) define Height_TopBar (Height_StatusBar + Height_NavBar) define Height_TapBar (IS_IPhoneX_All ? 83.0f:49.0f) define Height_BottomSafe (IS_IPhoneX_All? 34.0f:0.0f)