/// 状态栏高度
let JYStatusBarHeight:CGFloat = UIApplication.shared.statusBarFrame.size.height


// 获取appwindow
var JYWindow: UIWindow {
    get {
        if let app = UIApplication.shared.delegate as? AppDelegate {
            return app.window ?? JYWindowView()
        }
        return JYWindowView()
    }
}

/// 判断iPhoneX系列
var isPhoneX: Bool {
    get{
        if #available(iOS 11.0, *) {
            if JYWindow.safeAreaInsets.bottom  > 0 {
                return true
            }
        }
        return false
    }
}

            //  存在导航栏
            if #available(iOS 11.0, *),isPhoneX {
                progressView.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor, constant: 0).isActive = true
                webView.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor, constant: 0).isActive = true
            } else {
                webView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: 0).isActive = true
                progressView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: JYStatusBarHeight).isActive = true
            }

 

posted on 2019-08-23 14:08  懂事长qingzZ  阅读(441)  评论(0)    收藏  举报