【问题标题】:Perform segue with UIAlertAction [duplicate]使用 UIAlertAction 执行 segue [重复]
【发布时间】:2016-02-24 15:00:45
【问题描述】:

我想让“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)

【问题讨论】:

  • SIGABRT 发生在哪里?在performSegueWithIdentifier 或其他地方?

标签: ios swift segue uialertcontroller uialertaction


【解决方案1】:

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

【讨论】:

  • 谢谢!!我忘了设置情节提要 ID...
  • 还有一个问题.. 有什么办法可以同时将数组传递给下一个 ViewController?
  • 喜欢将 prepareforsegue 函数移入其中还是什么?
  • 有很多方法可以做到这一点,你肯定会在堆栈溢出中找到之前问过这个问题的人,只需搜索“segue array”,你会找到很多答案,祝你好运.
猜你喜欢
  • 1970-01-01
  • 2018-01-21
  • 1970-01-01
  • 2018-10-25
  • 2015-09-28
  • 1970-01-01
  • 1970-01-01
  • 2016-05-25
  • 1970-01-01
相关资源
最近更新 更多