diff QuestionnaireViewController.m @ 15:e45c3e631d20

View fiddling
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Thu, 17 Jan 2013 13:01:19 +0000
parents 6a9191f5b269
children
line wrap: on
line diff
--- a/QuestionnaireViewController.m	Wed Jan 16 19:03:51 2013 +0000
+++ b/QuestionnaireViewController.m	Thu Jan 17 13:01:19 2013 +0000
@@ -14,22 +14,7 @@
 @property (strong, nonatomic) NSArray * answerArray;
 @property (nonatomic) NSInteger currentQuestionIndex;
 /*
-@"I am familiar with music software and synthesisers."
-@"The best way to get a feel for the possibilities of the synth was with:"
-@"Interesting sounds could be discovered more quickly as a result of using:"
-@"A sound could be fine tuned more easily using:"
-@"The correspondence between the sliders and the grid was understandable."
-@"The interface that felt more familiar was:"
-@"Scrolling a greater distance the zoom grid seemed to correspond to larger  difference in the sound."
-@"The ability to see other presets on the grid was useful."
-@"The range of sounds was too limited to be able to judge the eventual usefulness of the interface."
-@"The interface better for generating new ideas was"
-@"The interface better for live performance would be:"
-	@"A specific type of sound could be found more quickly using:"
-	@"I felt more in control when using:"
-@"The Zoomer was an improvement on just using the randomiser."
-@"The combination of Zoomer and Sliders was more useful than either individually."
-@"Overall, I preferred using:"
+
 
 */
 
@@ -67,14 +52,16 @@
 }
 //----------------------------------------------------------------
 - (void)dealloc {
-    [_answerPressed release];
+
     [_questionText release];
+    [_titleText release];
     [super dealloc];
 }
 //----------------------------------------------------------------
 - (void)viewDidUnload {
     [self setAnswerPressed:nil];
     [self setQuestionText:nil];
+    [self setTitleText:nil];
     [super viewDidUnload];
 }
 //----------------------------------------------------------------
@@ -95,21 +82,76 @@
 
 - (IBAction)nextQuestionPressed:(id)sender {
     // save answer ? no button did that hopefully
+    
     // if last question show thanks
-    
     // else go to next
     self.currentQuestionIndex++;
+    if(self.currentQuestionIndex >= [self.questionArray count]){
+        [self showThanks];
+    }else{
+        [self loadQuestion:self.currentQuestionIndex];
+
+    }
+}
+
+- (IBAction)previousQuestionPressed:(id)sender {
+    self.currentQuestionIndex--;
+    if(self.currentQuestionIndex < 0){
+        // nothing
+        self.currentQuestionIndex = 0;
+    }else{
+        [self loadQuestion:self.currentQuestionIndex];
+    }
+}
+//----------------------------------------------------------------
+
+- (void)showThanks{
+    // hide next question button
+    // hide selector
+    self.titleText.text = @"Thank you!";
+    
+    self.questionText.text = @"Thanks for helping science help you. Visit the study website to keep abreast of exciting events.";
+}
+/*
+- (IBAction)previousQuestionPressed:(id)sender {
+    self.currentQuestionIndex--;
+    if(self.currentQuestionIndex > [self.questionArray count]){
+        [self showThanks];
+    }
     [self loadQuestion:self.currentQuestionIndex];
 }
+ */
 //----------------------------------------------------------------
 - (void)loadQuestion:(NSInteger)questionIndex {
     // populate text fields with question
+    NSString *qtitle;
+    qtitle = [@"Question " stringByAppendingFormat:@"%d",questionIndex+1];
+    self.titleText.text = qtitle;
+    
     self.questionText.text = [self.questionArray objectAtIndex:questionIndex];
     
+    // if question already answered show that
 }
 //----------------------------------------------------------------
 - (void)populateQuestionArray{
-    self.questionArray = [[NSArray alloc] initWithObjects:@"one", @"two", @"buckle", nil];
+    self.questionArray = [[NSArray alloc] initWithObjects:
+                          @"I am familiar with music software and synthesisers.",
+                          @"The best way to get a feel for the possibilities of the synth was with:",
+                          @"Interesting sounds could be discovered more quickly as a result of using:",
+                          @"A sound could be fine tuned more easily using:",
+                          @"The correspondence between the sliders and the grid was understandable.",
+                          @"The interface that felt more familiar was:",
+                          @"Scrolling a greater distance the zoom grid seemed to correspond to larger  difference in the sound.",
+                          @"The ability to see other presets on the grid was useful.",
+                          @"The range of sounds was too limited to be able to judge the eventual usefulness of the interface.",
+                          @"The interface better for generating new ideas was",
+                          @"The interface better for live performance would be:",
+                          @"A specific type of sound could be found more quickly using:",
+                          @"I felt more in control when using:",
+                          @"The Zoomer was an improvement on just using a randomiser.",
+                          @"The combination of Zoomer and Sliders was more useful than either individually.",
+                          @"Overall, I preferred using:",
+                          nil];
 }
 //----------------------------------------------------------------