【问题标题】:Change Background Color Status Bar iOS更改背景颜色状态栏 iOS
【发布时间】:2016-10-16 07:31:29
【问题描述】:

所以,我正在尝试这样做:

我尝试在状态栏后面使用 UIView 并将颜色设置为橙色,但是运行时,UIView 显示在状态栏正下方,所以它仍然是白色

我在互联网上尝试了许多解决方案,但没有一个有效。是的,它可以工作,但是当我移动到其他视图控制器并再次返回时,颜色消失了。我该怎么办?我正在使用 swift

【问题讨论】:

标签: swift uistatusbar


【解决方案1】:
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

【讨论】:

猜你喜欢
  • 2015-09-26
  • 2019-11-20
  • 1970-01-01
  • 2015-06-01
  • 2015-10-09
  • 1970-01-01
  • 1970-01-01
  • 2018-04-10
  • 2019-11-05
相关资源
最近更新 更多