Segue 不会执行 Swift [英] Segue won't execute Swift

查看:28
本文介绍了Segue 不会执行 Swift的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从集合视图(封装在视图控制器中)到另一个视图控制器的 segue 运行,但该函数从未被调用:

I have a segue running form a Collection View (wrapped in a view controller) in to a another view controller, how ever the function never gets called:

  func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
  println(segue.identifier)
  println(sender)
  println("SEGUE SELECTED:  \(segue.identifier)")

  if(segue.identifier == "segueToDetailView") {
    let cell = sender as CollectionViewCell;
  }
}

在函数开始处放置了一个断点,但从未到达.

Have placed a breakpoint at start of function but never reached.

感谢任何输入.

推荐答案

我建议不要从单元格或任何对象(如按钮)创建 segue(s).创建从一个 ViewController 到具有唯一标识符的 OtherViewController 的 segue.然后使用标识符自己调用 performSegueWithIdentifier.

I will suggest not to create segue(s) from cell or any object(like button). Create segue from one ViewController to OtherViewController with unique identifier. And then call the performSegueWithIdentifier yourself using the identifier.

这篇关于Segue 不会执行 Swift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆