打开弹出式菜单后,弹出式菜单背景的状态栏颜色变白。

问题描述 投票:0回答:1

我用弹出式程序打开一个页面,应用的主题是浅色的,所以状态栏的标签是黑色的。但是当打开popover后,状态栏的标签也变成了白色,状态栏里什么都看不到了。起初我以为是弹出式页面的问题,但很明显,当后台页面下来后,状态栏的色调发生了变化。https:/streamable.comhvjl4

如何才能防止这种情况的发生。

在应用程序中, preferredStatusBarStyle是白色的,除了这种情况,在任何页面都可以使用。

以下是打开popover的代码

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

有什么建议吗

swift statusbar popover
1个回答
0
投票

添加这行 ContainerListCard 阶层 viewDidLoad()

modalPresentationCapturesStatusBarAppearance = true
© www.soinside.com 2019 - 2024. All rights reserved.