我有一个带有两个 View Controller 的应用程序。我能够以编程方式呈现第二个 View Controller (我使用自定义弹出窗口/警报)但我无法以编程方式将其删除。我不想使用 UINavigationController。
// SHOW ALERT - UIViewcontroller - 1
let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
let popUp = storyboard.instantiateViewController(withIdentifier: "popupEmpty")
self.present(popUp, animated: true, completion: nil)
// HIDE ALERT - UIViewController -2
let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
let popUpVC = storyboard.instantiateViewController(withIdentifier: "popupEmpty")
self.navigationController?.pushViewController(popUpVC, animated: true) // ????
最佳答案
如果您展示某些东西,您需要拒绝。
self.dimiss(animated: true, completion: nil)
如果您插入某物,则需要弹出。
self.navigationController?.popViewController(animated: true)
关于ios - 如何以编程方式从堆栈中删除 UViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51984061/