【发布时间】:2017-06-26 10:25:37
【问题描述】:
我正在尝试实现一个按钮,该按钮将我的应用程序的背景从白色更改为黑色以及状态栏的颜色。现在我有
@IBAction func buttonTapped(_ sender: Any) {
self.view.backgroundColor = UIColor.black
UIApplication.shared.statusBarStyle = .lightContent
}
这似乎不起作用。有谁知道在不重新加载整个视图的情况下更改状态栏字体颜色的方法?
【问题讨论】:
-
@ESchlotter 将此添加到项目的 info.plist
UIViewControllerBasedStatusBarAppearance -
成功了,爱你
-
:) 你可以点赞这个评论
标签: ios swift xcode statusbar uistatusbar