Search code examples
iospresentmodalviewcontrollerpresentviewcontroller

Why does my UIStatusBar not display as desired through overriding preferredStatusBarStyle?


My status bar acts accordingly in the root controller in each tab of my UITabBarController. Once I add a modal to the UIViewController through present(viewControllerToPresent:) with .overFullscreen modalPresentationStyle it requires me to assign the preferredStatusBarStyle through the UIViewController that sent it. I need the UIViewController being presented to have a clear background and see through to the previoues UIViewControllers content. Am I doing something wrong?


Solution

  • I solved the issue with a friend. The correct answer follows:

    modalViewController.modalPresentationCapturesStatusBarAppearance = true