CNLiveConstant.swift
1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
// 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();
}