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?





[UPDATED] For Xcode 10+ & Swift 4.2+
This is the preferred method for iOS 7 and higher
In your application's
Info.plist, setView controller-based status bar appearancetoYES.Override
preferredStatusBarStyle(Apple docs) in each of your view controllers. For example:If you have
preferredStatusBarStylereturning a different preferred status bar style based on something that changes inside of your view controller (for example, whether the scroll position or whether a displayed image is dark), then you will want to callsetNeedsStatusBarAppearanceUpdate()when that state changes.iOS before version 7, deprecated method
Apple has deprecated this, so it will be removed in the future. Use the above method so that you don't have to rewrite it when the next iOS version is released.
If your application will support In your application's
Info.plist, setView controller-based status bar appearancetoNO.In
appDelegate.swift, thedidFinishLaunchingWithOptionsfunction, add:For Navigation Controller
If you use a navigation controller and you want the preferred status bar style of each view controller to be used and set
View controller-based status bar appearancetoYESin your application'sinfo.plist