iOS 13 status bar style
iOS 13.2, Swift 5.1
For me nothing worked from solutions mentioned before. After 5 hours I ended up on modalPresentationCapturesStatusBarAppearance flag .
destinationNavigationController.modalPresentationCapturesStatusBarAppearance = true sourceViewController.present(destinationNavigationController, animated: animated, completion: nil)
After this preferredStatusBarStyle
was called in presented VC.
override var preferredStatusBarStyle: UIStatusBarStyle { if #available(iOS 13.0, *) { if traitCollection.userInterfaceStyle == .light { return .darkContent } else { return .lightContent } } else { return .lightContent }}
I had the same issue on iOS13 while it was fine on iOS12 for my app. I have a TabBarController which holds 3 NavigationBarControllers, and I present TabBarController from a previous ViewController. I fixed it by setting .modalPresentationStyle to .fullScreen when presenting:
tabbarController.modalPresentationStyle = .fullScreen
Maybe it will help you somehow...
In iOS13, there is now a .darkContent option for UIStatusBarStyle. For black text, use this (instead of .default) for preferredStatusBarStyle.