所以,我正在努力做到这一点:
我尝试在状态栏后面使用UIView并将颜色设置为橙色,但在运行时,UIView显示在状态栏的正下方,所以它仍然是白色
我在互联网上尝试了很多解决方案,但没有一个能够正常工作.是的它有效但当我移动到其他视图控制器并再次返回时,颜色消失了.我该怎么办?我正在使用swift
小智 20
UIApplication.shared.statusBarStyle = .lightContent
UINavigationBar.appearance().clipsToBounds = true
let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as! UIView
statusBar.backgroundColor = UIColor.orange
Run Code Online (Sandbox Code Playgroud)
尝试在appDelegate的方法应用程序didFinishLaunchingWithOptions中使用此代码