How to change the iOS status bar icon and text color

Sometimes, when building an iOS app you may notice that the status bar color doesn't match your app's background. This can make it difficult for users to see status bar icons and text. It also might not look that great! Fortunately, it's easy to change the status bar color by simply configuring your Info.plist file.

Configuring the status bar in Info.plist

To customize your app's status bar color, add the following properties to your Info.plist file:




An image of the Penguin app configured with the above settings

Changing the status bar color with Swift code

If you need to programmatically change the status bar color, you can do so by using the following code in your View Controller:

   override func viewDidLoad() {
        super.viewDidLoad()
        self.setNeedsStatusBarAppearanceUpdate()
    }
    
    override var preferredStatusBarStyle: UIStatusBarStyle {
        return .darkContent // or .lightContent
    }

That's it! You now know what it takes to change your app's status bar text color either through your project's plist file or directly through code.

Home Knowledge Base Support Download