-2

I am building a Quiz app and got most of it done.

I want to use a single UIViewController for all the quiz questions, my issue is I'm not sure how to move or transition from one question to another using the same UIViewController.

So, if I have this basic outline:

Mockup of Quiz page

If a user clicks on any answer, I'd like it to transition from this current question to the next one (assuming there is one), if no further questions are to be had, then it can launch a segue to the quiz results page.

Is there a recommended way to transition between questions on the same view controller?

zardon
  • 1,601
  • 4
  • 23
  • 46
  • There's no recommended way at all. You make it appear however you want, whether that is just a simple basic text replacement or some fancy animation is entirely up to you. – Gruntcakes May 05 '16 at 19:41
  • @cardigan : What do you mean by using same ViewController for all question ?? You mean different instance of same ViewController one for each question or same instance of ViewController ???? – Sandeep Bhandari May 05 '16 at 20:25
  • The same instance of this ViewController. All questions would be displayed on this ViewController one at a time, cycling through them – zardon May 06 '16 at 11:24

1 Answers1

1

You need to do this programmatically. When the user taps an answer, just replace the text of the label with the next question, and the titles of the buttons with the answers for the next question.

If you want to do it all in a storyboard, you'll need a separate UIViewController for each question.

Brett Donald
  • 6,745
  • 4
  • 23
  • 51
  • I don't see why I need seperate UIViewController's for storyboard. Is it not possible to use a single UIViewcontroller, even in Storyboard; I have all the outlets hooked up. – zardon May 06 '16 at 11:25
  • I'll try some ideas based off what you said – zardon May 07 '16 at 08:50