//定义屏幕宽高
let kScreenWidth = UIScreen.main.bounds.size.width
let kScreenHeight = UIScreen.main.bounds.size.height
//判断是否是iPhone
let isPhone = Bool(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.phone)
//判断是否是iPad
let isPad = Bool(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad)
//判断是否是iPhone X
let isPhoneX = Bool(kScreenWidth >= 375.0 && kScreenHeight >= 812.0 && isPhone)
//导航条的高度
let kNavigationHeight = CGFloat(isPhoneX ? 88 : 64)
//状态栏高度
let kStatusBarHeight = CGFloat(isPhoneX ? 44 : 20)
//tabbar高度
let kTabBarHeight = CGFloat(isPhoneX ? (49 + 34) : 49)
//顶部安全区域远离高度
let kTopSafeHeight = CGFloat(isPhoneX ? 44 : 0)
//底部安全区域远离高度
let kBottomSafeHeight = CGFloat(isPhoneX ? 34 : 0)
网友评论