修改状态背景颜色
func setStatusBarBackgroundColor(color :UIColor) {
let statusBarWindow :UIView=UIApplication.shared.value(forKey:"statusBarWindow")as!UIView
let statusBar :UIView = statusBarWindow.value(forKey:"statusBar")as!UIView
if statusBar.responds(to:#selector(setter:UIView.backgroundColor)) {
// statusBar.backgroundColor = color
statusBar.tintColor = color
}
UINavigationBar.appearance().barTintColor = color
}
修改状态文字颜色
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
网友评论