【发布时间】:2022-10-07 22:02:28
【问题描述】:
标签: ios swift storyboard ios16
标签: ios swift storyboard ios16
请尝试以下适用于 iPhone 14 Pro 和 iPhone 14 max Pro 的解决方案
if #available(iOS 13.0, *) {
let window = UIApplication.shared.windows.first
let topPadding = window?.safeAreaInsets.top
let statusBar = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: topPadding ?? 0.0))
statusBar.backgroundColor = UIColor(named: "AppPrimaryColor")
UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.addSubview(statusBar)
}
希望这能解决您的问题。继续编码:)
【讨论】: