set custom color of status bar in swift?
问题 On a view controller, i want to set the color of status bar black but I am not able to change it. I am using below code for this purpose. func setUpUI() { self.navigationController?.setNavigationBarHidden(true, animated: false) UIApplication.shared.statusBarStyle = UIStatusBarStyle.default } I have also added the value in info.plist 回答1: You just override the return value of the status bar, like this: override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } 回答2: Use