现在还没有人拿到开机的iphone12以及12min,作为首发,关于适配屏幕的问题方案如下:
OC版本:
(1)状态栏高度
#define NavHeightForStatus (KScreenHeight >= 780 ? 44 : 20)
(2)整个navbar的占比
#define NaviH (KScreenHeight >= 780 ? 88 : 64) // 780是iPhone12min的高度
(3)整个KTabBarHeight的刘海高度
#define KTABBarHeight (KScreenHeight >= 780 ? 83 : 49) // 780是iPhone12min的高度
(4) 底部
#define BottomHeight (SCREEN_HEIGHT >= 780.0 ? 34 : 0)
//屏幕宽度
#define kScreenWidth [[UIScreen mainScreen] bounds].size.width
//屏幕高度
#define kScreenHeight [[UIScreen mainScreen] bounds].size.height
swift版本:
let KStatusBarHeight = UIScreen.main.bounds.size.height >= 780 ? 44 : 20 ;
let KNavigationHeight = UIScreen.main.bounds.size.height >= 780 ? 88.0 : 64.0 ;
let KTabBarHeight = UIScreen.main.bounds.size.height >= 780 ? 83.0 : 49.0 ;
let KSafetyZoneHeight = UIScreen.main.bounds.size.height >= 780 ? 34 : 0 ;
let kScreenHeight = (CGFloat)(UIScreen.main.bounds.size.height)
let kScreenWidth = (CGFloat)(UIScreen.main.bounds.size.width)
let ScalePpth = (CGFloat)((kScreenWidth / 375.0))
注:iphone12以及12Pro和12Max适配都是跟十一比较接近的,因此使用跟十一一样的适配比例即可,对于iphone12min的屏幕尺寸,高度仍然是大于iphone8Plus的高度(h= 736pt,width= 360pt),只是iphone12min的宽度比较窄,是360pt;