在 iOS 中,可以使用以下代码获取状态栏的高度:

var statusBarHeight: CGFloat {
    if #available(iOS 13.0, *) {
        let window = UIApplication.shared.windows.filter { $0.isKeyWindow }.first
        return window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0
    } else {
        return UIApplication.shared.statusBarFrame.height
    }
}

然而,iPhone 14 并未发布,因此无法提供特定于 iPhone 14 的解决方案。通常情况下,当 iPhone 14 发布后,可以通过更新的 iOS SDK 来获取相关的高度信息。

iOS 获取statusBarHeight 要处理iphone14

原文地址: https://www.cveoy.top/t/topic/ivKw 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录