36 lines
834 B
Swift
36 lines
834 B
Swift
//
|
|
// PrefixHeader.swift
|
|
// wallpaper_project
|
|
|
|
|
|
import Foundation
|
|
import UIKit
|
|
//布局设置
|
|
let Screen_Width = UIScreen.main.bounds.width
|
|
let Screen_height = UIScreen.main.bounds.height
|
|
|
|
let KScaleW = UIScreen.main.bounds.width/320.0
|
|
let KScaleH = UIScreen.main.bounds.height/568.0
|
|
|
|
var isFullScreen: Bool {
|
|
if #available(iOS 11, *) {
|
|
guard let w = UIApplication.shared.delegate?.window, let unwrapedWindow = w else {
|
|
return false
|
|
}
|
|
|
|
if unwrapedWindow.safeAreaInsets.left > 0 || unwrapedWindow.safeAreaInsets.bottom > 0 {
|
|
print(unwrapedWindow.safeAreaInsets)
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
var kSafeArea_Top: CGFloat {
|
|
return isFullScreen ? 44 : 20
|
|
}
|
|
|
|
var kSafeArea_Bottom: CGFloat {
|
|
return isFullScreen ? 34 : 0
|
|
}
|