swift - 获取 statusBarHeight

 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)