全网首发:iPhone12min系列的屏幕适配,最新iOS适配

现在还没有人拿到开机的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;


image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。