Mercurial > hg > tweakathon2ios
view Question.mm @ 44:d810aa9ca03a
times. cosmetic stuff
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Mon, 15 Dec 2014 17:33:41 +0000 |
parents | a223551fdc1f |
children |
line wrap: on
line source
// // Question.m // sonicZoom // // Created by Robert Tubb on 21/01/2013. // // #import "Question.h" @implementation Question @synthesize questionText = _questionText; @synthesize questionType = _questionType; @synthesize answer = _answer; static int theCount = 0; // WRONG -(id)initWithTextAndType:(NSString *)text:(QuestionType)type{ self = [super init]; if(self){ self.questionText = text; self.questionType = type; self.answer = -1; } return self; } //// - (id)init { return [self initWithTextAndType:@"Quo Vadis?":AGREE_DISAGREE]; } + (int) count { return theCount; } + (void) setCount:(int)c { theCount = c; } +(NSArray *)answersWithType:(QuestionType)type{ // get the set of answers depending on what type the q was // pseudo static variable if(type == AGREE_DISAGREE){ [Question setCount:NUM_CHOICES]; NSArray *answers = [[[NSArray alloc] initWithObjects: @"Strongly agree",@"Agree", @"Neither agree nor disagree", @"Disagree",@"Strongly disagree", nil] autorelease]; return answers; }else if(type == SLIDERS_ZOOMER){ [Question setCount:NUM_CHOICES]; NSArray *answers = [[[NSArray alloc] initWithObjects: @"definitely the Sliders", @"maybe the Sliders", @"Neither/Both equal", @"maybe the Zoomer", @"definitely the Zoomer", nil] autorelease]; return answers; }else{ return nil; } } /// @end