ios - 从选项卡 Controller 在当前上下文中呈现 Model View Controller 后出现黑屏

标签 ios iphone swift popup runtime-error

我正在为我自己的应用程序创建弹出式错误消息。我遵循了 Youtube 中的教程.由于我的应用程序是一个选项卡栏应用程序,当弹出窗口出现时,用户按下另一个选项卡,然后返回到该特定选项卡,背景已更改!!!!知道这里发生了什么吗?

<强>1。这是弹出窗口出现的时候 enter image description here

2.这是更改标签然后返回到该特定标签的时间 enter image description here

3.这是用户更改标签后关闭弹出窗口的最后状态 enter image description here

如果用户在开始时关闭弹出窗口,这些错误都不会发生!

let next = self.storyboard?.instantiateViewController(withIdentifier: "ErrorVC")
self.present(next!, animated: true, completion: nil)

这是我在我的页面中使用的代码,用于在满足条件时显示 pop !!!

我有 2 个 viewController,第二个是弹出窗口。

enter image description here

最佳答案

在显示 pop 的第一个 viewController 中,将 definesPresentationContext 属性设置为 UIViewControllertrue -查看

override func viewDidLoad() {
    super.viewDidLoad()
    definesPresentationContext = true
}

关于ios - 从选项卡 Controller 在当前上下文中呈现 Model View Controller 后出现黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51356334/

相关文章:

objective-c - 移除 UISearchBar 的内阴影

iphone - 什么会导致 dyldbootstrap 中出现 EXC_BAD_INSTRUCTION?

ios - 如何在 Xcode6 中为新创建的约束禁用 "Relative to margin"选项

ios - 操作无法完成。 (OSStatus 错误 -600。)无法在模拟器中运行应用程序

iphone - 禁用 iPhone 截图功能

xcode - "Generic parameter ' T ' could not be inferred"重载方法时出错

ios - UIVisualEffectView 在 iOS 9.1 中不起作用

ios - Xamarin "The executable was signed with invalid entitlements"

ios - 如何在 1 天后快速重置特定变量值

ios - 在前台推送通知