gpt4 book ai didi

iphone - 多个重复 View 的导航 Controller 设计

转载 作者:行者123 更新时间:2023-11-29 04:26:22 26 4
gpt4 key购买 nike

我很难理解我应该采取什么方法。我有一个带有问题列表的 TableView Controller ,如果您单击一行,它会推送一个新的 QuestionViewVontroller 来显示问题答案下一步按钮(或完成按钮)。当用户单击下一步时,我想加载下一个问题(从表格 View 列表中),但我仍然希望导航正常工作(后退按钮会将您带到表格 View )。

我开始认为我应该保留相同的 QuestionViewController 并加载问题数据。这是正确的吗?或者我应该使用模态视图?

最佳答案

这里有几个选项。

  1. 使用相同的 QuestionViewController 并重新填充它,就像您提到的那样。

  2. 推送一个新的 QuestionViewController 并使用自定义后退按钮,该按钮要么弹出到 Root View Controller ,要么弹出到给定 View Controller 。

#2 中两个选项的代码如下,其中“self”是当前 View Controller (您的问题 Controller )。

[self.navigationController popToRootViewControllerAnimated:YES];  //this would pop to your UITableViewController, assuming it was the root

[self.navigationController popToViewController:yourTableViewControllerHere Animated:YES]; //this would work as long as you passed a reference to your UITableViewController to your question controllers

如何解决问题取决于您。但是,如果您决定使用相同的 QuestionViewController,请在导入新问题时包含一个吸引人的动画,以便用户知道发生了什么并使您的应用程序变得更酷:)

关于iphone - 多个重复 View 的导航 Controller 设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12288254/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com