【发布时间】:2015-11-21 02:54:46
【问题描述】:
1) 基本上,数据正在通过 ViewControllers,但迟到了。 nextViewController 在执行代码时,传递了一些变量
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if (segue.identifier == "goto") ...
尚未设置。仍然为零。
2) 我的第二个问题与第一个问题有关:我正在尝试从 selectedCell 传递数据,因此我在委托 didSelectItemAtIndexPath 上分配了一个全局变量。但是当它到达prepareForSegue 时,我要传递的变量仍然为零。
有什么帮助吗?
【问题讨论】:
-
请发布您的代码。
-
事情在 1) 为 segue 做准备仅在 nextviewcontroller 已经运行时分配值,并且在 2) 仅在为 segue 做准备后调用委托。有什么办法安排这个吗?
-
您好 Pedro,您是在 Storyboard 中设置了从 tableviewCell 到下一个 ViewController 的转场,还是以编程方式使用 performSegueWithIdentifier?
-
两者。我在 Storyboard 上做了它来声明 segue 并更改其标识符并使用 performSegueWithIdentifier 来传递一些变量,这是错误的吗?
标签: ios swift uiviewcontroller null