0

我正在尝试从警报操作中弹出控制器并进入另一个视图控制器。我想在进入另一个控制器后立即执行一些操作,比如打开另一个警报控制器。我该怎么做?

UIAlertController.getAlertView("Success", message: "Your password has been successfully changed!", cancelButtonTitle: "Ok", cancelHandler: { (action) in
 self.navigationController?.popViewController(animated: true)
                        }).show(self)
4

1 回答 1

0

如果您想在单击警报操作时返回上一个 viewController,那么下面的代码将为您提供帮助。

    let alert = UIAlertController(title: "Success", message: "Your password has been successfully changed!", preferredStyle: UIAlertController.Style.alert)
    alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.cancel, handler: { action in
        //perfoem any action you want on click of OK
                    self.navigationController?.popViewController(animated: true)
                }))
    self.present(alert, animated: true, completion: nil)
于 2020-02-25T07:10:44.023 回答