swift - 获取 statusBarHeight

2021-06-25  本文已影响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);
    }
上一篇下一篇

猜你喜欢

热点阅读