问题描述
我正在尝试将状态栏的样式更改为.Light
,但是我在swift 1.2中实现的先前代码似乎不再起作用..这是代码:
I'm attempting to change my status bar's style to .Light
but the previous code I implemented in swift 1.2 seems not to work anymore.. here's the code:
override func viewDidLoad() {
super.viewDidLoad()
UIApplication.sharedApplication().statusBarStyle = .LightContent
}
现在我将View controller-based status bar appearance
info.plist设置设置为YES,并阅读UIKit文档,这将否定statusBarStyle的任何更改并将其保留为默认设置.但是,当我将设置更改为"NO"并更改statusBarStyle时,在调试器中得到了此<Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable
.那么,这是Xcode中的错误吗?因为要更改状态栏样式,您必须将info.plist设置更改为NO,但是在这种情况下发生..错误
now I have my View controller-based status bar appearance
info.plist setting to YES, and reading the UIKit doc, this will negate any statusBarStyle changes and keep it at default. However when I change the setting to 'NO' and change the statusBarStyle, I get this <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable
in my debugger.. So is this a bug in Xcode? because to change the status bar style you must change info.plist setting to NO, but when that happens.. error
推荐答案
Apple已添加了在部署信息中更改状态栏样式的功能.只需选择光".
Apple have added the capability to change the status bar style in the deployment info. Simply choose 'Light'.
还将Info.plist
这篇关于如何在Swift 2/iOS 9中正确更改状态栏样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!