[英]remove black background when switching tab of `UITabBarController`
我有4个选项卡的UITabBarController
。 在第一个选项卡的ViewController中,我使用popUpVC.modalPresentationStyle = .overCurrentContext
呈现了Popup
但是现在当我切换到secondTab
Dollor_Icon ,然后立即回到firstTab
...我得到了blackBG而不是透明BG。 像这样:
我的模态表示法代码:
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 '
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.