Declarations

To manage its relationships and responsibilities, the QuizViewController object needs five instance variables and two methods. In this section, you will declare these in the QuizViewController header file, QuizViewController.h.

Declaring instance variables

Here are the five instance variables QuizViewController needs:

questions

a pointer to an NSMutableArray containing instances of NSString

answers

a pointer to another NSMutableArray containing instances of NSString

currentQuestionIndex

an int that holds the index of the current question in the questions array

questionField

a pointer to the UILabel object where the current question will be displayed

answerField

a pointer to the UILabel object where the current answer will be displayed

In ...

Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.