0
點擊我需要做兩個動作。顯示該消息,然後轉到另一個用戶界面。但這裏只是任務1執行而不是任務2爲什麼點擊它沒有做任務2?
@IBAction func sendMessage(_ sender: AnyObject) {
// TASK 1 - OK
let alert = UIAlertController(title: "Task 1", message: "Test message.", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true)
// TASK 2 - FAIL (does not execute)
let x = XyzViewController()
x.body = "test";
self.present(x, animated: false, completion: nil)
}
查看控制檯。應該有一個錯誤消息告訴你這個問題。 – rmaddy
並且您的任務2代碼正在執行。使用調試器來確認。 – rmaddy