我试图通过dismissViewController调用IBAction
dismissViewController
IBAction
@IBAction func cancel(sender: AnyObject) { self.dismissViewControllerAnimated(false, completion: nil) println("cancel") } @IBAction func done(sender: AnyObject) { self.dismissViewControllerAnimated(false, completion: nil) println("done") }
我可以在控制台输出中看到 println 消息,但 ViewController 永远不会被解雇。可能是什么问题呢?
从您的图像看来,您似乎使用 push 呈现了 ViewController
dismissViewControllerAnimated用于关闭使用模态呈现的ViewController
dismissViewControllerAnimated
Swift 2
navigationController.popViewControllerAnimated(true)
Swift 4
navigationController?.popViewController(animated: true) dismiss(animated: true, completion: nil)