简体   繁体   中英

What is the best way of implementing a UIViewController that is in charge of asking the user various questions?

I would really appreciate it if this question wasn't voted to be closed. I realize it is somewhat subjective, however, at the heart of it, it is very objective. There is a concrete thing I am trying to achieve, and knowing of the ways it can be done is precisely what I need.

I am designing an iOS (iPad only) app that is going to present the user with a bunch of questions.

Right now, I've got a split view controller, the Master shows a list of topics. I want selecting a topic to cause the DetailViewController to start asking questions.

Some of the questions will be multiple choice, and some will be fill in the blank, etc., so I have a custom UIViewControllers (whose UIs are defined with .xib files) for each type of question.

I am new to iOS, but it seems like the best implementation would cause my DetailViewController to just cycle through a bunch of other, custom UIViewControllers, depending on what questions it wanted to ask. Ideally, I'd like to be able to let the user navigate between questions at their choosing, preferably with a swipe gesture. Note that these questions aren't known until runtime, so I need to be able to cycle through the questions programmatically (as in not as part of the storyboard, if that even makes sense as a sentence in iOS-talk).

What type of container should this be in? How would the container handle transitions between questions? How would I recognize a swipe gesture in order to go between questions? etc.?

Does anybody have some insight/guidance how I can achieve this? Right now, I can conceptualize various methods, but without input and someone who knows what they're doing, I'm just running in place.

Thanks!

You are giving a very good description of a UIPageViewController! Look into it and see what you think. You can "go next" manually, or let the user swipe to "go next". And best of all, you get to supply the "next" view controller dynamically, in real time, at the very moment the user asks to "go next", and what you supply can be any view controller at all, so you can make your choice depend on the situation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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