如何更新或发送 int 到正在进行的视图控制器
你好,我有一个测验应用程序,在回答每个问题后,它会在 UILabel 中给你一个分数,所以我有一个按钮,当你回答正确的答案时,你会得到 10 分,如果回答错误的答案,你会得到 0 分,但是我该如何做将 int 分数值带入下一个问题,该问题由 navController 推送。
另外,如果有人知道一种方法,可以在每次回答问题时更新测验的最后一个视图(ScoreView),这比更新每个视图的分数更好
Hi I have a quiz app that gives you a score in a UILabel after answering each question, so I have a button that when you hit the correct answer you get 10 points and if hit the wrong answer you get 0 points, but how do I bring the int score value to the next question, which is pushed by a navController.
Also if anyone knows a way to just have the last view (ScoreView) of the quiz be updated every time you answer the question that would be better than updating the score on every view
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在应用程序委托中声明int 属性,并且您可以从应用程序中的任何位置更新或读取它。您无需承担额外的负担将结果从第一个视图控制器一直传送到最后一个视图控制器。
You can declare an int property in the app delegate, and you can update or read it from anywhere in your application. You have no need to take the extra burden to carry the result from the first view controller all the way to the last view controller.