Mercurial > hg > soniczoomios
comparison QuestionnaireViewController.mm @ 31:23ef179c3748
Ben / Christian 0.2
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Fri, 01 Mar 2013 13:28:45 +0000 |
parents | fabb3a5cdfc9 |
children | ab7c86d0f3d8 |
comparison
equal
deleted
inserted
replaced
30:c0a6f7c66719 | 31:23ef179c3748 |
---|---|
60 [self loadQuestion:self.currentQuestionIndex]; | 60 [self loadQuestion:self.currentQuestionIndex]; |
61 | 61 |
62 self.previousButton.hidden = YES; // dont bother | 62 self.previousButton.hidden = YES; // dont bother |
63 self.commentText.hidden = YES; | 63 self.commentText.hidden = YES; |
64 self.finishButton.hidden = YES; | 64 self.finishButton.hidden = YES; |
65 self.nextButton.hidden = YES; | |
66 | |
67 self.lickertOptions.hidden = NO; | |
68 self.interfacePreferenceOptions.hidden = YES; | |
65 } | 69 } |
66 //---------------------------------------------------------------- | 70 //---------------------------------------------------------------- |
67 - (void)didReceiveMemoryWarning | 71 - (void)didReceiveMemoryWarning |
68 { | 72 { |
69 [super didReceiveMemoryWarning]; | 73 [super didReceiveMemoryWarning]; |
76 [_titleText release]; | 80 [_titleText release]; |
77 [_finishButton release]; | 81 [_finishButton release]; |
78 [_nextButton release]; | 82 [_nextButton release]; |
79 [_previousButton release]; | 83 [_previousButton release]; |
80 [_commentText release]; | 84 [_commentText release]; |
85 [_numberChooser release]; | |
86 [_interfacePreferenceOptions release]; | |
87 [_lickertOptions release]; | |
88 [_pleaseAnswer release]; | |
81 [super dealloc]; | 89 [super dealloc]; |
82 } | 90 } |
83 //---------------------------------------------------------------- | 91 //---------------------------------------------------------------- |
84 - (void)viewDidUnload { | 92 - (void)viewDidUnload { |
85 [self setQuestionText:nil]; | 93 [self setQuestionText:nil]; |
86 [self setTitleText:nil]; | 94 [self setTitleText:nil]; |
87 [self setFinishButton:nil]; | 95 [self setFinishButton:nil]; |
88 [self setNextButton:nil]; | 96 [self setNextButton:nil]; |
89 [self setPreviousButton:nil]; | 97 [self setPreviousButton:nil]; |
90 [self setCommentText:nil]; | 98 [self setCommentText:nil]; |
99 [self setNumberChooser:nil]; | |
100 [self setInterfacePreferenceOptions:nil]; | |
101 [self setLickertOptions:nil]; | |
102 [self setPleaseAnswer:nil]; | |
91 [super viewDidUnload]; | 103 [super viewDidUnload]; |
92 } | 104 } |
93 //---------------------------------------------------------------- | 105 //---------------------------------------------------------------- |
94 -(IBAction)hide:(id)sender{ | 106 -(IBAction)hide:(id)sender{ |
95 // called when finish button hit | 107 // called when finish button hit |
150 // hide selector | 162 // hide selector |
151 self.picker.hidden = YES; | 163 self.picker.hidden = YES; |
152 self.previousButton.hidden = YES; | 164 self.previousButton.hidden = YES; |
153 self.finishButton.hidden = NO; | 165 self.finishButton.hidden = NO; |
154 | 166 |
167 self.lickertOptions.hidden = YES; | |
168 self.interfacePreferenceOptions.hidden = YES; | |
169 | |
155 self.titleText.text = @"Thank you!"; | 170 self.titleText.text = @"Thank you!"; |
156 | 171 self.numberChooser.hidden = YES; |
157 self.commentText.hidden = NO; | 172 self.commentText.hidden = NO; |
158 | 173 |
159 self.questionText.text = @"Thanks for helping science help you. Feel free to add further comments in the text box below, and then press 'finish' to go back and use the app, unhassled."; | 174 self.questionText.text = @"Thanks for helping science help you. Feel free to add further comments in the text box below, and then press 'finish' to go back and use the app, unhassled."; |
160 } | 175 } |
161 | 176 |
171 self.questionText.text = curQ.questionText; | 186 self.questionText.text = curQ.questionText; |
172 | 187 |
173 | 188 |
174 // refresh picker view content | 189 // refresh picker view content |
175 [picker reloadComponent:0]; | 190 [picker reloadComponent:0]; |
176 | 191 |
177 | 192 // show correct option number labels |
178 NSLog(@"Prev answer answerInt %d", curQ.answer); | 193 if(curQ.questionType == AGREE_DISAGREE){ |
194 self.lickertOptions.hidden = NO; | |
195 self.interfacePreferenceOptions.hidden = YES; | |
196 }else if(curQ.questionType == SLIDERS_ZOOMER){ | |
197 self.lickertOptions.hidden = YES; | |
198 self.interfacePreferenceOptions.hidden = NO; | |
199 } | |
200 | |
201 //NSLog(@"Prev answer answerInt %d", curQ.answer); | |
179 [picker selectRow:2 inComponent:0 animated:YES]; | 202 [picker selectRow:2 inComponent:0 animated:YES]; |
180 | 203 |
181 } | 204 } |
182 //---------------------------------------------------------------- | 205 //---------------------------------------------------------------- |
183 - (void)populateQuestionArray{ | 206 - (void)populateQuestionArray{ |
261 // Customer code | 284 // Customer code |
262 NSLog(@"RETURN DELEGATE"); | 285 NSLog(@"RETURN DELEGATE"); |
263 [self hide:self ]; | 286 [self hide:self ]; |
264 return NO; | 287 return NO; |
265 } | 288 } |
289 - (IBAction)answerChosen:(id)sender { | |
290 self.pleaseAnswer.hidden = YES; | |
291 UISegmentedControl *seg = (UISegmentedControl *)sender; | |
292 Question *curQ = [questionArray objectAtIndex:self.currentQuestionIndex]; | |
293 // set question answerArray | |
294 curQ.answer = seg.selectedSegmentIndex; | |
295 | |
296 // chek wot we just rote | |
297 | |
298 NSLog(@"Answer: %d",curQ.answer); | |
299 | |
300 // automatically go next q | |
301 self.currentQuestionIndex++; | |
302 if(self.currentQuestionIndex >= [self.questionArray count]){ | |
303 [self showThanks]; | |
304 }else{ | |
305 [self loadQuestion:self.currentQuestionIndex]; | |
306 | |
307 } | |
308 | |
309 } | |
266 @end // end implementation | 310 @end // end implementation |
267 //---------------------------------------------------------------- | 311 //---------------------------------------------------------------- |
268 //---------------------------------------------------------------- | 312 //---------------------------------------------------------------- |