如何消除堆叠在一起的弹出窗口?

How to dismiss pop ups stacked on top of each other?

提问人:Kaleb 提问时间:11/15/2023 最后编辑:HangarRashKaleb 更新时间:11/15/2023 访问量:24

问:

我有一个弹出窗口,一旦用户完成弹出窗口,他就会选择保存和下一个弹出窗口。当用户完成该按钮时,他们按下保存和完成按钮,然后关闭弹出窗口。但是第一个弹出窗口永远不会被关闭,因此一旦用户关闭了第二个弹出窗口,它就会将用户带回第一个弹出窗口。一旦它进入第二个弹出窗口,我该如何关闭它?

第一个 Vc

class NewRecipeViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UITextFieldDelegate{ 
    @IBAction func saveBtn(_ sender: UIButton) {
        if let error = error {
            howAlert(message: "Error updating in Firestore: \(error.localizedDescription)")
        } else {
            DispatchQueue.main.async {
                self.performSegue(withIdentifier: "SegueIdentifier", sender: self)
            }
        }
    }
}

第二个 Vc

class AddIngredient: HomeViewController, UITableViewDelegate, UITableViewDataSource {
    override func viewDidLoad() {
        super.viewDidLoad()
    }
}

我试着放在任何地方,但我似乎无法让它工作。大多数情况下,它要么关闭第一个 vc,然后从不切换到第二个 vc,要么它关闭第二个 vc,然后关闭第二个 vc 而不是第一个。self?.dismiss(animated: true, completion: nil)

迅捷 UIKIT

评论


答: 暂无答案