UIApplication.sharedApplication()。在iOS 9中不推荐使用setStatusBarStyle() [英] UIApplication.sharedApplication().setStatusBarStyle() deprecated in iOS 9
问题描述
我一直在使用
UIApplication.sharedApplication().setStatusBarStyle()
在我的appDelegate中,它运行良好,但自从iOS 9以来,这种方法已被弃用,我找不到替代方案。
In my appDelegate and it has worked fine, but since iOS 9, this method is deprecated and I can't find an alternative.
我想将整个应用程序的状态栏样式更改为.LightContent,
但是xCode给出的唯一建议是在每个VC中单独处理这个;
I want to change the statusbar style to .LightContent for my whole application, but the only suggestion xCode gives me is to handle this in every VC separately with;
override func preferredStatusBarStyle() -> UIStatusBarStyle {
return .LightContent
}
有谁知道怎么做这适用于整个应用程序?
Has anyone an idea how to do this for the whole application?
提前致谢
推荐答案
我想我找到了解决方案。
我最终设置了
I think I have found a solution. I ended up setting the
查看基于控制器的状态栏外观
布尔值到否
在我的info.plist文件中。
In my info.plist file.
然后我去了我的目标常规设置 - >部署信息
并将下拉选项
状态栏样式
更改为 Light
默认
Then I went to my target's General settings -> Deployment info
and changed the dropdown option
Status Bar Style
to Light
instead of Default
这将我的整个应用程序的状态栏样式更改为 Light
,正如我想要的那样。
This changed the statusbar style to Light
for my whole application, just what I wanted.
我希望这有帮助!
这篇关于UIApplication.sharedApplication()。在iOS 9中不推荐使用setStatusBarStyle()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!