快速警报不执行操作

时间:2019-12-27 18:45:49

标签: swift

我有一个显示输入不完整警报的应用程序,如下所示:

[[D, -L], [L, D]]

其中 if (foodChosen == "") { let alertAction = UIAlertController(title: "Continue?", message: "No food selected. Do you wish to continue?", preferredStyle: .alert) let yes = UIAlertAction(title: "Yes", style: .default, handler: { (UIAlertAction) in self.finish = true }) alertAction.addAction(yes) let no = UIAlertAction(title: "No", style: .default, handler: { (UIAlertAction) in }) alertAction.addAction(no) self.present(alertAction, animated: true, completion: nil) } else { self.finish = true } 在视图控制器的开始处初始化为self.finish

即使选择“是”按钮,self.finish的值也不会更新。谁能看到原因?

0 个答案:

没有答案