iOS Change Status Bar Color For ViewController containment


If you are using UIViewControllerContainment there are a few other methods that are worth looking at.

When you want a child viewController to control the presentation of the status bar (i.e. if the child is positioned at the top of the screen

in Swift

class RootViewController: UIViewController {

    private let messageBarViewController = MessageBarViewController()        

    override func childViewControllerForStatusBarStyle() -> UIViewController? {
        return messageBarViewController

    override func viewDidLoad() {
        //add child vc code here...


class MessageBarViewController: UIViewController {
    override func preferredStatusBarStyle() -> UIStatusBarStyle {
        return .Default