現(xiàn)在還沒有人拿到開機的iphone12以及12min虚婿,作為首發(fā)赋铝,關于適配屏幕的問題方案如下:
OC版本:
(1)狀態(tài)欄高度
#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卤橄;
image.png