更改背景颜色状态栏 iOS
Change Background Color Status Bar iOS
所以,我正在努力做到这一点:
我尝试在状态栏后面使用 UIView 并将颜色设置为橙色,但是当 运行 时,UIView 显示在状态栏的正下方,所以它仍然是白色
我正在尝试互联网上的许多解决方案,但其中 none 有效。是的,它可以工作,但是当我移动到其他视图控制器并再次返回时,颜色消失了。我应该怎么办?我正在使用 swift
UIApplication.shared.statusBarStyle = .lightContent
UINavigationBar.appearance().clipsToBounds = true
let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as! UIView
statusBar.backgroundColor = UIColor.orange
尝试在您的 appDelegate 方法中使用此代码 application didFinishLaunchingWithOptions
所以,我正在努力做到这一点:
我尝试在状态栏后面使用 UIView 并将颜色设置为橙色,但是当 运行 时,UIView 显示在状态栏的正下方,所以它仍然是白色
我正在尝试互联网上的许多解决方案,但其中 none 有效。是的,它可以工作,但是当我移动到其他视图控制器并再次返回时,颜色消失了。我应该怎么办?我正在使用 swift
UIApplication.shared.statusBarStyle = .lightContent
UINavigationBar.appearance().clipsToBounds = true
let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as! UIView
statusBar.backgroundColor = UIColor.orange
尝试在您的 appDelegate 方法中使用此代码 application didFinishLaunchingWithOptions