我正在尝试将状态栏的颜色更改为蓝色或其他某种颜色。
这可能吗,或者Apple不允许吗?
注意:此解决方案在iOS 13及更高版本下失败。
Plist中的第一个设置View controller-based status bar appearance为NO
View controller-based status bar appearance
NO
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as! UIView if statusBar.responds(to:#selector(setter: UIView.backgroundColor)) { statusBar.backgroundColor = UIColor.blue } UIApplication.shared.statusBarStyle = .lightContent return true }
输出屏幕截图如下