我正在为我自己的应用程序创建弹出式错误消息。我遵循了 Youtube 中的教程.由于我的应用程序是一个选项卡栏应用程序,当弹出窗口出现时,用户按下另一个选项卡,然后返回到该特定选项卡,背景已更改!!!!知道这里发生了什么吗?
如果用户在开始时关闭弹出窗口,这些错误都不会发生!
let next = self.storyboard?.instantiateViewController(withIdentifier: "ErrorVC")
self.present(next!, animated: true, completion: nil)
这是我在我的页面中使用的代码,用于在满足条件时显示 pop !!!
我有 2 个 viewController
,第二个是弹出窗口。
最佳答案
在显示 pop 的第一个
viewController
中,将 definesPresentationContext
属性设置为 UIViewController
的 true
-查看
override func viewDidLoad() {
super.viewDidLoad()
definesPresentationContext = true
}
关于ios - 从选项卡 Controller 在当前上下文中呈现 Model View Controller 后出现黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51356334/