在 iOS13 中,我无法再更改状态栏的背景颜色,因为无法再使用“键值”访问状态栏。有没有人弄清楚这是怎么可能的,或者是否知道在 iOS13 的最终版本中是可能的?
我遇到了不同的建议,比如使用 UIApplications StatusBarView(在 xcode 11、beta 7 中不再可用)或使用 statusbarmanager。两者都不允许访问状态栏。
let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as! UIView
if statusBar.responds(to: #selector(setter: UIView.backgroundColor)) {
statusBar.backgroundColor = <Some Color>
}
Run Code Online (Sandbox Code Playgroud)
我希望状态栏能够获得我需要的背景颜色。