Search code examples
swiftstatusbarpopover

Status bar tint color of the background of popover gets white after opening the popover


I open a page programmatically with popover, the theme of the app is light so the status bar labels are black. But when the popover gets open, the the labels are status bar also gets white and nothing can be seen in the status bar. First I thought is it the problem of the popover page, but apparently, when the background page comes down, the tint color of the status bar changed. see the video here: https://streamable.com/ehvjl4

how can I prevent this.

In the app, the preferredStatusBarStyleis white, and it works in any pages expect this case.

here is the code to open popover

 func showlistCard() {
     let vc = ContainerlistCard()
     vc.modalPresentationStyle = .popover
     present(vc, animated: true, completion: nil)
 }

Any suggestion? many thanks


Solution

  • Add this line to ContainerListCard class in viewDidLoad()

    modalPresentationCapturesStatusBarAppearance = true