Directly paste Button’s click event:
func cancelButton() { let alertCtrl = UIAlertController.init(title: "是否放弃修改支付密码?", message: nil, preferredStyle: UIAlertControllerStyle.alert) alertCtrl.addAction(UIAlertAction.init(title: "否", style: UIAlertActionStyle.cancel, handler: nil)) alertCtrl.addAction(UIAlertAction.init(title: "是", style: UIAlertActionStyle.default, handler: { (action: UIAlertAction) in self.navigationController?.popViewController(animated: true) })) self.present(alertCtrl, animated: true, completion: nil) }
The
popof
navigationController
feels very slow. After clickingto
, I feel there is a 2-second delay before returning to the upper interface. WeChat gives up changing the payment password. , the interface returned immediately after clicking. Does anyone know any solution?
I wrote a demo using your code and found that there is no 2 second delay.
It means that the problem with your code is not this part.