ios - 使用 UIAlertAction 执行 segue

标签 ios swift segue uialertcontroller uialertaction

<分区>

我想让“Next”按钮执行 segue 以移动到“PersonalInformation”(一个 UIViewController)

但是我得到一个带有代码的“SIGABRT 信号”.. 我该如何解决?

let alert = UIAlertController(title:"Confirmation", message: confirmationMessage, preferredStyle: UIAlertControllerStyle.Alert)

let confirmBtn : UIAlertAction = UIAlertAction(title: "Next", style: UIAlertActionStyle.Default, handler: {(action:UIAlertAction!)-> Void in

    self.performSegueWithIdentifier("PersonalInformation", sender: self)

})

let cancelBtn : UIAlertAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil)

alert.addAction(cancelBtn)
alert.addAction(confirmBtn)

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

最佳答案

这主要是由错误的 Storyboard或 xib/nib 连接引起的,请确保您在 Storyboard中具有正确的连接,这些连接具有下一个按钮或您要移动到的按钮。

关于ios - 使用 UIAlertAction 执行 segue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35605623/

相关文章:

c++ - Xcode 7.1 和 C++

ios - Xcode:威胁 1:Sigabrt 错误

ios - SwipeCellKit 操作不会执行 segue

ios - Swift 复制方法(Code Pattern)

ios - 在 iOS 应用程序 (Swift) 中使用 telegram 分享消息

ios - 未调用 TableView 的 cellForRowAtIndexPath?

android - 在 Android 和 IOS 中,我可以在不打开邮件应用程序的情况下使用 IONIC 发送邮件吗?

ios - 如何在 iOS swift 中获取点击点(坐标)

ios - Segue 后退按钮在 iOS 9 中消失

ios - 如何阻止 Storyboard 剧集