Mercurial > hg > soniczoomios
diff QuestionnaireViewController.mm @ 28:e2c62db1e265
Started timer stuff
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Mon, 18 Feb 2013 11:45:05 +0000 |
parents | ae4d2c3ce5e0 |
children | fabb3a5cdfc9 |
line wrap: on
line diff
--- a/QuestionnaireViewController.mm Wed Feb 13 17:03:56 2013 +0000 +++ b/QuestionnaireViewController.mm Mon Feb 18 11:45:05 2013 +0000 @@ -60,7 +60,8 @@ [self loadQuestion:self.currentQuestionIndex]; self.previousButton.hidden = YES; // dont bother - + self.commentText.hidden = YES; + self.finishButton.hidden = YES; } //---------------------------------------------------------------- - (void)didReceiveMemoryWarning @@ -76,6 +77,7 @@ [_finishButton release]; [_nextButton release]; [_previousButton release]; + [_commentText release]; [super dealloc]; } //---------------------------------------------------------------- @@ -85,6 +87,7 @@ [self setFinishButton:nil]; [self setNextButton:nil]; [self setPreviousButton:nil]; + [self setCommentText:nil]; [super viewDidUnload]; } //---------------------------------------------------------------- @@ -101,10 +104,14 @@ answersArray.push_back(q.answer); } + const char *userComments = [self.commentText.text cStringUsingEncoding: NSUTF8StringEncoding]; - ((testApp *)self.theOFAppRef)->questionnaireHidden(answersArray); + ((testApp *)self.theOFAppRef)->questionnaireHidden(answersArray, userComments); + [self.commentText resignFirstResponder]; + self.view.hidden = YES; } + //---------------------------------------------------------------- -(IBAction)show:(id)sender{ self.view.hidden = NO; @@ -143,10 +150,13 @@ // hide selector self.picker.hidden = YES; self.previousButton.hidden = YES; + self.finishButton.hidden = NO; self.titleText.text = @"Thank you!"; - self.questionText.text = @"Thanks for helping science help you. Visit the study website to keep abreast of exciting events."; + self.commentText.hidden = NO; + + 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 to the app."; } //---------------------------------------------------------------- @@ -238,7 +248,21 @@ NSLog(@"Answer: %d",curQ.answer); } - +//---------------------------------------------------------------- +#pragma mark UITextViewDelegate functions +/* + This answer was useful to me, but I was also looking for the callback function from the "Go" button, which I found is: + - (BOOL) textFieldShouldReturn:(UITextField *)textField { // Customer code return YES; } + + You will need to send the UITextField delegate to your view controller for that to work. + + */ + - (BOOL) textFieldShouldReturn:(UITextField *)textField { + // Customer code + NSLog(@"RETURN DELEGATE"); + [self hide:self ]; + return NO; + } @end // end implementation //---------------------------------------------------------------- //----------------------------------------------------------------