Change Status Bar style in XCode 8.2 / Swift 3.0 (No "View controller-based status bar appearance")

how to change status bar color in xcode
ios 13 status bar style
change status bar text color ios
ios change status bar style
ios 13 status bar text color
view controller-based status bar appearance
preferredstatusbarstyle objective-c
ios status bar

I am trying to modify the appearance of my status bar (make text white/ set the Style to "light"). I managed to set the background color by adding this to my AppDelegate.swift file:

let statWindow = UIApplication.shared.value(forKey:"statusBarWindow") as! UIView
let statusBar = statWindow.subviews[0] as UIView
statusBar.backgroundColor = UIColor(red: 0/255.0, green: 0/255.0, blue: 0/255.0, alpha: 1.0)

However, when I go to change the style of the text of the status bar, even changing this under General > Deployment Info > Status Bar Style (changing this to "Light") does not work.

I also tried to modify the status bar through Info.plist, but there is no field for "View controller-based status bar appearance" (see second image). Also, there is no option for a "light" style under the Status bar style option (see below image):

Status bar style options:

No view controller status bar field:

In each UIViewController of your application, you should override preferredStatusBarStyle property:

override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent }

and eventually, call:

<your controller>.setNeedsStatusBarAppearanceUpdate()

If this statusBar style is throughout all your application, you should make a BaseViewController class that implement this, and make all you view controllers inherit from BaseViewController.

how do I properly change my status bar style in swift 2/ iOS 9 , Apple have added the capability to change the status bar style in the deployment info. Simply choose 'Light'. ScreenShot of Xcode Swift 3 just add View controller-based status bar appearance with value NO to info.plist Change Status Bar style in XCode 8.2 / Swift 3.0 (No “View controller-based status bar appearance”). Closures in Swift 3. A project (Xcode 8.2.1) demonstrating closures in iOS with Swift 3. Blocks/closures allow you to create chunks of almost any type of code that can be called almost anywhere, anytime (like in the future). They are self-contained but know about local variable around them.

The step you missed is Info.plist.

Open the info.plist file of your app and set the UIViewControllerBasedStatusBarAppearance to NO (as shown below).

Note: This key can be added if not already present by:

1) Hovering over an existing entry to reveal add/remove icons:

2) Click the plus icon to add a new key/value pair:

3) Paste UIViewControllerBasedStatusBarAppearance into the key field and set it's value to NO. Note the key will change to View controller-based status... when deselected but it's the same thing:

Status Bar Style - Swift 3 - change at any time, Change Status Bar style in XCode 8.2 / Swift 3.0 (No “View controller-based status bar appearance”). I am trying to modify the appearance of my status bar  In here tintColor attribute change the background color of the navigation bar. barTintColor attribute affect to the color of the. back indicator image. button titles. button images. This code not affect to the color of navigation bar title. It still remains on black color.

swift 3

if View controller-based status bar appearance = YES in Info.plist

then use this extension for all NavigationController

    extension UINavigationController
        override open var preferredStatusBarStyle: UIStatusBarStyle {
        return .lightContent

if there is no UINavigationController and only have UIViewController then use Below code:

    extension UIViewController
        override open var preferredStatusBarStyle: UIStatusBarStyle {
        return .lightContent

objective c

create category class

For UIViewController

In UIViewController+StatusBarStyle.h

 @interface UIViewController (StatusBarStyle)

In UIViewController+StatusBarStyle.m

 #import "UIViewController+StatusBarStyle.h"

 @implementation UIViewController (StatusBarStyle)

 -(UIStatusBarStyle)preferredStatusBarStyle {
  return UIStatusBarStyleLightContent;


For UINavigationController

In UINavigationController+StatusBarStyle.h

 @interface UINavigationController (StatusBarStyle)

In UINavigationController+StatusBarStyle.m

 #import "UINavigationController+StatusBarStyle.h"

 @implementation UINavigationController (StatusBarStyle)

 -(UIStatusBarStyle)preferredStatusBarStyle {
  return UIStatusBarStyleLightContent;


statusBarStyle, swift 3 1.Change in info.plist the row View controller-based status bar status bar appearance = NO and remove the (in ViewController.swift): override The code in Swift 3.0 Xcode 8.2 works for me: override open var preferredStatusBarStyle:  😍 A simple NoticeBar written by Swift 3, similar with QQ notice view. 😀 ScreenShots. Remember: If you want the status bar style change, you must set the View controller-based status bar appearance to NO in the info.plist. Support. Swift 3.0 & iOS 8+ Installation CocoaPods. add pod 'NoticeBar' to your Podfile. Run pod install OR pod update

For Xcode 10 You can simply create a class for UIViewController or UITableViewController ecc. and put it before your UIViewController class, you can call this class in all view controller is needed a light content status bar...

class UIViewControllerWithLightStatusBar: UIViewController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return UIStatusBarStyle.lightContent

in AppDelegate set the status Bar:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.

    UINavigationBar.appearance().isTranslucent = false
    UINavigationBar.appearance().clipsToBounds = false
    UINavigationBar.appearance().barStyle = .blackOpaque

    return true

now you change the class UIViewController with UIViewControllerWithLightStatusBar

class YourViewController: UIViewControllerWithLightStatusBar {

And that's it...

Change Status Bar style in XCode 8.2 / Swift 3.0 (No “View controller , To customize the status bar's style for each of your view controllers, override their preferredStatusBarStyle property. See Also. Getting the Status Bar  Coordinate the status bar style with your app design. The visual style of the status bar’s text and indicators is either light or dark, and can be set globally for your app or individually for different screens. A dark status bar works well above light-colored content and a light status bar works well above dark-colored content.

I have found four different way to change the iOS status bar in Xcode , I've been trying to change the color of the status bar in my Swift app, and I've in the dropdown box here: General->Deployment Info->Status Bar Style. 3. Simulated Metrics is just for display and provides no actual change during runtime. Change Status Bar style in XCode 8.2 / Swift 3.0 (No "View controller-​based  XCFit a.k.a ( XCUI, Cucumberish and Fitnesse Integration Tests) is a full stack Xcode BDD framework for iOS apps written in Swift. XCFit allows us to write BDD Style API/Contract level, UI and Acceptance Tests with Swift in human readable language using tools like Given/When/Then, Cucumber and Fitnesse in Xcode.

setStatusBarHidden is deprecated in iOS 9.0, If I just replace 'setStatusBarHidden' with 'prefersStatusBarHidden', I get 'instance method not found'. Swift 3.1 Xcode 8.2.1. Change in info.plist the row View controller-based status bar appearance and set it to NO Swift 3 with Xcode 8.3.​3 Here is my swift code for setting status bar hidden and style. Once you have cloned or forked this repo, open the HomeAccessPlus.xcworkspace file in Xcode to begin development. This project uses git-flow as its branching model. The current development environment is with Xcode 8.2 and Swift 3.0.2.

Hide when the background is tapped. config. dimMode =. gray (interactive: true) // Disable the interactive pan-to-hide gesture. config. interactiveHide = false // Specify a status bar style to if the message is displayed directly under the status bar. config. preferredStatusBarStyle =. lightContent // Specify one or more event listeners to respond to show and hide events. config. eventListeners. append { event in if case. didHide = event { print (" yep ") } } SwiftMessages. show (config

  • see also here in addition to this answer:…
  • You missed some details from my post - that field doesn't exist in my info.plist :( I added a second image to show you what my info.plist file looks like
  • I believe @enghong is suggesting you add that key to the Info.plist. You can do so by hovering over an existing entry which should reveal a plus/minus icon pair, click the plus icon, paste the suggested key, and set the value to NO (which was the default for me). You should then have white status bar text throughout the application without needing to manually set each UIViewController subclass. At least that's what worked for me.
  • This is the correct answer, exactly what I was looking for. With BOTH keys set, the global status bar content is set to light, no code needed.