【发布时间】:2016-06-07 05:20:15
【问题描述】:
我正在尝试显示注销警报。当用户点击 Yes 时,我希望我的视图控制器使用可以为我提供完成处理程序的方法来关闭。
视图控制器位于导航控制器内,是堆栈中的第二个。
我想出了以下代码:
@IBAction func logOut() {
let logOutAlert = UIAlertController.init(title: "Log out", message: "Are you sure ?", preferredStyle:.Alert)
logOutAlert.addAction(UIAlertAction.init(title: "Yes", style: .Default) { (UIAlertAction) -> Void in
//Present entry view ==> NOT EXECUTED
self.dismissViewControllerAnimated(true, completion:nil)
})
logOutAlert.addAction(UIAlertAction.init(title: "Cancel", style: .Cancel, handler: nil))
self.presentViewController(logOutAlert, animated: true, completion: nil)
}
self.dismissViewControllerAnimated(true, completion:nil) 行已读取,但没有执行任何操作。
【问题讨论】:
标签: ios swift uialertview dismiss