Segue won't execute Swift

自作多情 提交于 2019-12-12 06:21:29

问题


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.

Any input appreciated.


回答1:


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.



来源:https://stackoverflow.com/questions/29062765/segue-wont-execute-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!