Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8561497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:30:50+00:00 2026-06-11T16:30:50+00:00

I am creating a quiz app that uses a ViewController named QuestionViewController to load

  • 0

I am creating a quiz app that uses a ViewController named QuestionViewController to load and display the question data from a custom Question class. Right now, I am just checking the questionType of to determine how the Answer children of the Question need to be displayed. Then I have many if/then statements to display the answerTypes which can be:

  • buttonType (radio/checkbox)
  • inputFieldType
  • datePickerType
  • (any other types)

This works ok, but it’s really sloppy. I would like to load the Question then find the type of question using if/then in which I believe I should create custom view controller for each questionType and display that and maybe add protocols to return when the input has changed. Is this the right way to do this? I’d like to keep question types as dynamic as possible so I can add future types should we need them.

Am I on the right track? Is there something I’m missing/should improve on?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:30:51+00:00Added an answer on June 11, 2026 at 4:30 pm

    It sounds to me like you are on the right track. One thing to keep in mind though is that your questions will ALL likely have to do a few things the same, such as… display the question! This lends itself well to subclassing as follows:

    UIViewController -> QuestionViewController -> CustomQuestionViewController1
    UIViewController -> QuestionViewController -> CustomQuestionViewController2
    UIViewController -> QuestionViewController -> CustomQuestionViewController3

    etc.

    Every Question will have to have certain information to display regardless of the question/answer type. For example, it is likely that every one of your questions will have some sort of UILabel or UITextView displaying the text for the question. This label’s position, font, etc. will probably not change from question to question, so it should be setup in the question’s QuestionViewController, where as the answers (whose format will likely vary, as you mention) can be setup in the various CustomQuestionViewControllers that you implement. This will greatly reduce potential code duplication in your question’s view controllers because the things they do the same can be done inside your QuestionViewController.

    If you did your subclassing like below…

    UIViewController -> CustomQuestionViewController1

    UIViewController -> CustomQuestionViewController2

    You would likely end up with a lot of duplicate code setting up the basic question display.

    Also, name them better than CustomQuestionViewController1 haha.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a quiz app that will display something depending on their results
I am creating a quiz app and I have a custom ItemizedOverlay where I
I'm creating quiz app of sorts for Android. The questions shall be posed in
I am creating a quiz style app for iOS using phonegap. The app allows
I am trying to write a quiz application.i have the follwing model. class Question(db.Model):
I'm creating a quiz app, and I was wondering instead of using multiple if
I'm creating a quiz, and I'm storing responses from players in a SQL Server
Creating a searchable contacts kind of app. Below is my code public class EmployeeList
I am creating a quiz app which has 2 views, MMAppViewController and a subview
I am creating a quiz creation form that requires sections of the form to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.