CNLiveConstant.swift 1.92 KB
//
//  CNLiveConstant.swift
//  metaCode
//
//  Created by daojian on 2023/6/2.
//  全局常量

import Foundation

///屏幕宽度
let KSreenWidth = UIScreen.main.bounds.width
///屏幕高度
let KSreenHeight = UIScreen.main.bounds.height

///状态栏高度
let KStatusBarHeight:CGFloat = UIApplication.shared.statusBarFrame.height;
///导航栏高度
let KNavigationHeight:CGFloat = (KStatusBarHeight + 44)
///tabbar高度
let KTabBarHeight:CGFloat = (KStatusBarHeight == 44 ? 83 : 49)

//MARK: - 常用三方key
let kBucketName_QN:String = "mam-wjjtest-802"

//MARK: - 常用背景色
///控制器背景色
let KVCBackgroupColor = UIColor("#F9F9F9")

/**
 判断是否是iPhone X系列
 */
public func is_iPhoneX_series() -> Bool {
    var iPhoneXSeries: Bool = false
    if (UIDevice.current.userInterfaceIdiom != .phone)  {
        return iPhoneXSeries
    }
    let window = UIApplication.shared.delegate?.window!!
    if (window?.safeAreaInsets.bottom ?? 0.0 > 0.0) {
        iPhoneXSeries = false;
    }
    return iPhoneXSeries;
}

/**
 获取系统状态栏高度
 */
public func get_system_statusBar_height() -> CGFloat {
    return is_iPhoneX_series() ? 44 : 20;
}

/**
 获取系统导航高度
 */
public func get_system_nav_height() -> CGFloat {
    return is_iPhoneX_series() ? (44.0 + 44.0) : 64;
}

/**
 获取系统导航UI高度
 */
public func get_system_nav_ui_height() -> CGFloat {
    return get_system_nav_height() - get_system_statusBar_height();
}

/**
 获取系统tabbar高度
 */
public func get_system_tabbar_height() -> CGFloat {
    return is_iPhoneX_series() ? 83.0 : 49.0;
}

/**
 获取系统tabbarUI高度
 */
public func get_system_tabbar_ui_height() -> CGFloat {
    return 49.0;
}

/**
 获取系统tabbarUI增加的高度 (因iPhoneX系列底部有安全区域增加的高度)
 */
public func get_system_tabbar_ui_offsetHeight() -> CGFloat {
    return get_system_tabbar_height() - get_system_tabbar_ui_height();
}