赞
踩
//屏高
let kScreenHeight = UIScreen.main.bounds.size.height
//屏宽
let kScreenWidth = UIScreen.main.bounds.size.width
//iPhonex以上判断
let IS_IPhoneX_All = (kScreenHeight == 812 || kScreenHeight == 896)
//导航栏高
let HYDevice_NaviBar_Height = (IS_IPhoneX_All ? 88 : 64)
//状态栏高
let HYDevice_StatusBar_Height = (IS_IPhoneX_All ? 44 : 20)
//选项卡高
let HYDevice_TabBar_Height = (IS_IPhoneX_All ? 83 : 49)
//安全区高
let HYDevice_SafeArea_BottomHeight = (IS_IPhoneX_All ? 34 : 0)
/**宽度比例*/
func XL_ScaleWidth(_ font:CGFloat) -> (CGFloat) {
return (kScreenWidth/375)*font
}
/**高度比例*/
func XL_ScaleHeight(_ font:CGFloat) -> (CGFloat) {
return kScreenHeight/667*font
}
/**字体比例*/
func XL_ScaleFont(_ font:CGFloat) -> (CGFloat) {
return kScreenWidth/375*font
}
————————————————
版权声明:本文为CSDN博主「huanglinxiao」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/huanglinxiao/article/details/85990248
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。