Designing Quiz

You are going to write the Quiz application using the MVC pattern. Here is a breakdown of the instances you will be creating and working with:

  • The model layer will consist of two instances of [String].

  • The view layer will consist of two instances of UILabel and two instances of UIButton.

  • The controller layer will consist of an instance of ViewController.

These instances and their relationships are laid out in the diagram for Quiz shown in Figure 1.7.

Figure 1.7  Object diagram for Quiz

Object diagram for Quiz

Figure 1.7 is the big picture of how the finished Quiz application will work. For example, when the Next Question button is tapped, it will trigger a method in ViewController. A method is a lot like a function – a list of instructions to be executed. This method will retrieve a new question from the array of questions and ask the top label to display that question.

It is OK if this diagram does not make sense yet – it will by the end of the chapter. Refer back to it as you build the app to see how it is taking shape.

You are going to build Quiz in steps, starting with the visual interface for the application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset