gpt4 book ai didi

ios - `UITabBarController` 切换标签时去除黑色背景

转载 作者:搜寻专家 更新时间:2023-11-01 06:28:53 24 4
gpt4 key购买 nike

我的 UITabBarController 有 4 个选项卡。在第一个选项卡的 ViewController 中,我使用 popUpVC.modalPresentationStyle = .overCurrentContext

呈现 Popup

所以我得到了这个(那是我想要的完美):
enter image description here

但现在当我切换到 secondTab Dollor_Icon,然后立即返回到 firstTab 时...我得到的是 blackBG 而不是透明的BG。像这样:
enter image description here

我的模态展示代码:

let popUpVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "PopUp")
popUpVC.modalPresentationStyle = .overCurrentContext
self.present(popUpVC, animated: true)

希望摆脱那个黑色背景,为什么会这样?
谢谢!

最佳答案

将此添加到您的 firstTabViewController ViewDidLoad() 方法中:

    definesPresentationContext = true

希望您的问题得到解决。

有关 definesPresentationContext 的更多详细信息,请参阅 https://developer.apple.com/documentation/uikit/uiviewcontroller/1621456-definespresentationcontext '

关于ios - `UITabBarController` 切换标签时去除黑色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50015547/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com