rt300@14
|
1 //
|
rt300@14
|
2 // QuestionnaireViewController.m
|
rt300@14
|
3 // oscSenderExample
|
rt300@14
|
4 //
|
rt300@14
|
5 // Created by Robert Tubb on 16/01/2013.
|
rt300@14
|
6 //
|
rt300@14
|
7 //
|
rt300@14
|
8
|
rt300@14
|
9 #import "QuestionnaireViewController.h"
|
rt300@14
|
10
|
rt300@14
|
11 @interface QuestionnaireViewController ()
|
rt300@14
|
12 // the "model" is an array of questions
|
rt300@14
|
13 @property (strong, nonatomic) NSArray * questionArray;
|
rt300@14
|
14 @property (strong, nonatomic) NSArray * answerArray;
|
rt300@14
|
15 @property (nonatomic) NSInteger currentQuestionIndex;
|
rt300@14
|
16 /*
|
rt300@15
|
17
|
rt300@14
|
18
|
rt300@14
|
19 */
|
rt300@14
|
20
|
rt300@14
|
21 @end
|
rt300@14
|
22
|
rt300@14
|
23 @implementation QuestionnaireViewController
|
rt300@14
|
24
|
rt300@14
|
25 //----------------------------------------------------------------
|
rt300@14
|
26 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
rt300@14
|
27 {
|
rt300@14
|
28 self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
rt300@14
|
29 if (self) {
|
rt300@14
|
30 // Custom initialization
|
rt300@14
|
31
|
rt300@14
|
32 [self populateQuestionArray ];
|
rt300@14
|
33
|
rt300@14
|
34
|
rt300@14
|
35 }
|
rt300@14
|
36 return self;
|
rt300@14
|
37 }
|
rt300@14
|
38 //----------------------------------------------------------------
|
rt300@14
|
39 - (void)viewDidLoad
|
rt300@14
|
40 {
|
rt300@14
|
41 [super viewDidLoad];
|
rt300@14
|
42 // Do any additional setup after loading the view from its nib.
|
rt300@14
|
43 self.currentQuestionIndex = 0;
|
rt300@14
|
44 // load question 1
|
rt300@14
|
45 [self loadQuestion:self.currentQuestionIndex];
|
rt300@14
|
46 }
|
rt300@14
|
47 //----------------------------------------------------------------
|
rt300@14
|
48 - (void)didReceiveMemoryWarning
|
rt300@14
|
49 {
|
rt300@14
|
50 [super didReceiveMemoryWarning];
|
rt300@14
|
51 // Dispose of any resources that can be recreated.
|
rt300@14
|
52 }
|
rt300@14
|
53 //----------------------------------------------------------------
|
rt300@14
|
54 - (void)dealloc {
|
rt300@15
|
55
|
rt300@14
|
56 [_questionText release];
|
rt300@15
|
57 [_titleText release];
|
rt300@14
|
58 [super dealloc];
|
rt300@14
|
59 }
|
rt300@14
|
60 //----------------------------------------------------------------
|
rt300@14
|
61 - (void)viewDidUnload {
|
rt300@14
|
62 [self setAnswerPressed:nil];
|
rt300@14
|
63 [self setQuestionText:nil];
|
rt300@15
|
64 [self setTitleText:nil];
|
rt300@14
|
65 [super viewDidUnload];
|
rt300@14
|
66 }
|
rt300@14
|
67 //----------------------------------------------------------------
|
rt300@14
|
68 - (IBAction)answerWasSelected:(id)sender {
|
rt300@14
|
69 // look at property?
|
rt300@14
|
70
|
rt300@14
|
71 }
|
rt300@14
|
72
|
rt300@14
|
73 //----------------------------------------------------------------
|
rt300@14
|
74 -(IBAction)hide:(id)sender{
|
rt300@14
|
75 self.view.hidden = YES;
|
rt300@14
|
76 }
|
rt300@14
|
77 //----------------------------------------------------------------
|
rt300@14
|
78 -(IBAction)show:(id)sender{
|
rt300@14
|
79 self.view.hidden = NO;
|
rt300@14
|
80 }
|
rt300@14
|
81 //----------------------------------------------------------------
|
rt300@14
|
82
|
rt300@14
|
83 - (IBAction)nextQuestionPressed:(id)sender {
|
rt300@14
|
84 // save answer ? no button did that hopefully
|
rt300@15
|
85
|
rt300@14
|
86 // if last question show thanks
|
rt300@14
|
87 // else go to next
|
rt300@14
|
88 self.currentQuestionIndex++;
|
rt300@15
|
89 if(self.currentQuestionIndex >= [self.questionArray count]){
|
rt300@15
|
90 [self showThanks];
|
rt300@15
|
91 }else{
|
rt300@15
|
92 [self loadQuestion:self.currentQuestionIndex];
|
rt300@15
|
93
|
rt300@15
|
94 }
|
rt300@15
|
95 }
|
rt300@15
|
96
|
rt300@15
|
97 - (IBAction)previousQuestionPressed:(id)sender {
|
rt300@15
|
98 self.currentQuestionIndex--;
|
rt300@15
|
99 if(self.currentQuestionIndex < 0){
|
rt300@15
|
100 // nothing
|
rt300@15
|
101 self.currentQuestionIndex = 0;
|
rt300@15
|
102 }else{
|
rt300@15
|
103 [self loadQuestion:self.currentQuestionIndex];
|
rt300@15
|
104 }
|
rt300@15
|
105 }
|
rt300@15
|
106 //----------------------------------------------------------------
|
rt300@15
|
107
|
rt300@15
|
108 - (void)showThanks{
|
rt300@15
|
109 // hide next question button
|
rt300@15
|
110 // hide selector
|
rt300@15
|
111 self.titleText.text = @"Thank you!";
|
rt300@15
|
112
|
rt300@15
|
113 self.questionText.text = @"Thanks for helping science help you. Visit the study website to keep abreast of exciting events.";
|
rt300@15
|
114 }
|
rt300@15
|
115 /*
|
rt300@15
|
116 - (IBAction)previousQuestionPressed:(id)sender {
|
rt300@15
|
117 self.currentQuestionIndex--;
|
rt300@15
|
118 if(self.currentQuestionIndex > [self.questionArray count]){
|
rt300@15
|
119 [self showThanks];
|
rt300@15
|
120 }
|
rt300@14
|
121 [self loadQuestion:self.currentQuestionIndex];
|
rt300@14
|
122 }
|
rt300@15
|
123 */
|
rt300@14
|
124 //----------------------------------------------------------------
|
rt300@14
|
125 - (void)loadQuestion:(NSInteger)questionIndex {
|
rt300@14
|
126 // populate text fields with question
|
rt300@15
|
127 NSString *qtitle;
|
rt300@15
|
128 qtitle = [@"Question " stringByAppendingFormat:@"%d",questionIndex+1];
|
rt300@15
|
129 self.titleText.text = qtitle;
|
rt300@15
|
130
|
rt300@14
|
131 self.questionText.text = [self.questionArray objectAtIndex:questionIndex];
|
rt300@14
|
132
|
rt300@15
|
133 // if question already answered show that
|
rt300@14
|
134 }
|
rt300@14
|
135 //----------------------------------------------------------------
|
rt300@14
|
136 - (void)populateQuestionArray{
|
rt300@15
|
137 self.questionArray = [[NSArray alloc] initWithObjects:
|
rt300@15
|
138 @"I am familiar with music software and synthesisers.",
|
rt300@15
|
139 @"The best way to get a feel for the possibilities of the synth was with:",
|
rt300@15
|
140 @"Interesting sounds could be discovered more quickly as a result of using:",
|
rt300@15
|
141 @"A sound could be fine tuned more easily using:",
|
rt300@15
|
142 @"The correspondence between the sliders and the grid was understandable.",
|
rt300@15
|
143 @"The interface that felt more familiar was:",
|
rt300@15
|
144 @"Scrolling a greater distance the zoom grid seemed to correspond to larger difference in the sound.",
|
rt300@15
|
145 @"The ability to see other presets on the grid was useful.",
|
rt300@15
|
146 @"The range of sounds was too limited to be able to judge the eventual usefulness of the interface.",
|
rt300@15
|
147 @"The interface better for generating new ideas was",
|
rt300@15
|
148 @"The interface better for live performance would be:",
|
rt300@15
|
149 @"A specific type of sound could be found more quickly using:",
|
rt300@15
|
150 @"I felt more in control when using:",
|
rt300@15
|
151 @"The Zoomer was an improvement on just using a randomiser.",
|
rt300@15
|
152 @"The combination of Zoomer and Sliders was more useful than either individually.",
|
rt300@15
|
153 @"Overall, I preferred using:",
|
rt300@15
|
154 nil];
|
rt300@14
|
155 }
|
rt300@14
|
156 //----------------------------------------------------------------
|
rt300@14
|
157
|
rt300@14
|
158 @end // end implementation |