小编Bah*_*ray的帖子

如何在Swift中使用警报视图展开segue?

我有几个视图控制器.如果确认了警报视图,我需要返回第一个View Controller.如果没有放松Segue,我就会这样做:

@IBAction func unwindToDelete ( segue: UIStoryboardSegue ) {

    let alertView = UIAlertController(title: "Delete?", message: "Are you sure you wante to delete?", preferredStyle: .ActionSheet)

    let deleteAction = UIAlertAction (title: "Delete", style: .Destructive ) { alertAction in

        self.deleteChoice = true
    }

    let cancelAction = UIAlertAction (title: "Cancel", style: .Cancel ) {  alertAction in

    }

    alertView.addAction(deleteAction)
    alertView.addAction(cancelAction)

    self.presentViewController(alertView, animated: true, completion: nil)

}
Run Code Online (Sandbox Code Playgroud)

但是,如果我这样做,在这段代码中它会崩溃,因为最后一行代码.

这是错误:

2015-04-30 14:59:45.605 PhotosCollection[4624:182995] 
popToViewController:transition: called on <UINavigationController 0x7a67aeb0> 
while an existing transition or presentation is occurring; …
Run Code Online (Sandbox Code Playgroud)

iphone uialertview swift unwind-segue

0
推荐指数
1
解决办法
3019
查看次数

标签 统计

iphone ×1

swift ×1

uialertview ×1

unwind-segue ×1