IOS13以后获取状态栏高度 statusHeight

  • Post author:
  • Post category:其他


let statusHeight:CGFloat = {
   if #available(iOS 13.0, *) {
       let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene
       let frame = scene?.statusBarManager?.statusBarFrame
       return frame?.height ?? 0
    } else {
       return UIApplication.shared.statusBarFrame.size.height
    }
}()



版权声明:本文为jieWang2原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。