将信息从一个故事板传递到另一个故事板
我很难将分数从模型页面传递给我的一个控制器之一。我有一个计数器可以总计分数,但是当我尝试将其添加到另一个故事板上的标签中时,它将原始声明的值为零,而不是更新的版本。
I am having trouble passing the score to quiz app from a model page to one of my controllers. I have a counter that totals up the score, however when I try and add it to a label on another storyboard it takes the original declared value of zero rather than the updated version.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,它将为您提供零,因为得分变量没有更新。
将得分从一个视图控制器传递到另一个视图控制器的一种方法是:
这是您可以执行的示例代码:
Obviously, it will give you zero because there is no update in score variable.
One way to pass score from one view controller to other view controller is as:
Here is sample code you can do: