logo头像
Snippet 博客主题

NO Title!

  1. 改变状态栏颜色
1
2
3
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
1
2
3
4
5
//修改状态栏背景颜色
func setStatusBarBackgroundColor(color: UIColor) {
guard let statusBar = UIApplication.shared.value(forKeyPath: "statusBarWindow.statusBar") as? UIView else { return }
statusBar.backgroundColor = color
}