对于ios 13,我无法设置状态栏的文本颜色。如何获取statusBarManager的视图?如何仅更改文本颜色?
由于:
由于未捕获的异常“ NSInternalInconsistencyException”而终止应用程序,原因:“在UIApplication上名为-statusBar或-statusBarWindow的应用程序:此代码必须更改,因为不再有状态栏或状态栏窗口。而是在窗口场景上使用statusBarManager对象。”
我当前的代码:
func setStatusBarTextColor(_ color: UIColor) {
if #available(iOS 13.0, *) {
// How to do for iOS 13??
} else {
if let statusBar = UIApplication.shared.value(forKey: "statusBar") as? UIView {
statusBar.setValue(color, forKey: "foregroundColor")
}
}
}
Run Code Online (Sandbox Code Playgroud)
我已经找到了这个/sf/answers/4017632601/,但这不是我想要的