简体   繁体   English

适用于iOS测验应用程序的ViewController

[英]ViewController for an iOS quiz app

maybe is a stupid question but I cannt find a solution. 也许是一个愚蠢的问题,但我找不到解决方案。

I'm a newbie developer and I develop iOS apps using RubyMotion. 我是新手开发人员,并且使用RubyMotion开发iOS应用。

I'm creating a quiz app: when a user start a quiz I init a UIviewcontroller with the first question and 3 buttons with the possible answers. 我正在创建一个测验应用程序:当用户启动测验时,我使用第一个问题和带有可能答案的3个按钮来初始化UIviewcontroller。

User select an answer and go to the next question increasing a progress bar. 用户选择一个答案并转到下一个问题,增加进度条。

Now I have a doubt: can I use UIViewController or I have to use UIPageViewController? 现在我有一个疑问:我可以使用UIViewController还是必须使用UIPageViewController?

If I use UIViewController with 50 questions I have to init 50 controller: is not dangerous for resources? 如果我对50个问题使用UIViewController,则必须初始化50控制器:资源危险吗? Or is better to destroy a controller when I create the controller for the next question? 还是在为下一个问题创建控制器时销毁控制器更好?

Thank you (and sorry if the question is obvious) 谢谢您(如果问题很明显,对不起)

No you can use one ViewController object because you will have same UI one every page like Progressbar, Question Label and 3 Buttons. 不,您不能使用一个ViewController对象,因为每个页面都将具有相同的UI,例如Progressbar,Question Label和3 Buttons。

If an user select an Answer you need to update the new question label and 3 buttons options with some Progress on progressbar and display activityIndicatorview to Refresh the Page for new question or some custom animation. 如果用户选择一个答案,则需要更新新的问题标签和3个按钮选项,并在进度栏上显示一些进度,并显示activityIndi​​catorview以刷新页面以查找新问题或某些自定义动画。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM