如何在Swift 3中设置状态栏样式 [英] How to set Status Bar Style in Swift 3
问题描述
我正在使用Xcode 8.0 beta 4.
在以前的版本中,UIViewController有方法设置状态栏样式
public func preferredStatusBarStyle() - > UIStatusBarStyle
然而,我发现它在Swift 3中改为Get ONLY varaiable。
public var preferredStatusBarStyle:UIStatusBarStyle {get}
如何提供在我的UIViewController中使用的样式?
iOS 11和Swift 4,Xcode 9 (也适用于iOS 10和Swift 3)
-
更改 info.plist 行
查看基于控制器的状态栏外观并将其设置为否 -
didFinishLaunchingWithOptions
b
$UIApplication.shared.statusBarStyle = .lightContent
I'm using Xcode 8.0 beta 4.
In previous version, UIViewController have method to set the status bar style
public func preferredStatusBarStyle() -> UIStatusBarStyle
However, I found it changed to a "Get ONLY varaiable" in Swift 3.
public var preferredStatusBarStyle: UIStatusBarStyle { get }
How can provide the style to use in my UIViewController?
iOS 11 and Swift 4, Xcode 9 (Also works fine with iOS 10 and Swift 3)
Change in info.plist the row View controller-based status bar appearance and set it to NO
Change in appDelegate.swift in didFinishLaunchingWithOptions
UIApplication.shared.statusBarStyle = .lightContent
这篇关于如何在Swift 3中设置状态栏样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!