美文网首页
swift - 获取 statusBarHeight

swift - 获取 statusBarHeight

作者: 开了那么 | 来源:发表于2021-06-25 09:40 被阅读0次
     var statusBarHeight = 0.0
        if #available(iOS 13.0, *){
            let statusBarManager:UIStatusBarManager = UIApplication.shared.windows.first!.windowScene!.statusBarManager!
        statusBarHeight = Double(Int(statusBarManager.statusBarFrame.size.height));
        }
        else {
            statusBarHeight = Double(UIApplication.shared.statusBarFrame.size.height);
        }
    

    相关文章

      网友评论

          本文标题:swift - 获取 statusBarHeight

          本文链接:https://www.haomeiwen.com/subject/nnvnyltx.html