我有以下代碼UIAlertController斯威夫特
let alertController = UIAlertController(title: "error_title".localized, message: "error".localized, preferredStyle: .ActionSheet)
let retryAction = UIAlertAction(
title: "retry".localized,
style: .Default,
handler: {
(action:UIAlertAction!) in
self.fetch()
}
)
alertController.addAction(retryAction)
let cancelAction = UIAlertAction(
title: "cancel".localized,
style: .Default,
handler: {
(action:UIAlertAction!) in
self.navigationController!.popViewControllerAnimated(true)
}
)
alertController.addAction(cancelAction)
self.presentViewController(alertController, animated: true, completion: nil)
的對話框顯示正常,但是當我點擊一個按鈕,它不會調用處理函數。任何想法?
你說的是點擊'retry'按鈕嗎? –
這兩個按鈕都不起作用 – Yamila
您是否嘗試添加斷點或日誌記錄以查看它是否至少到達那裏?可能聽起來很愚蠢,但這將是第一步。 –