Skip to content

Instantly share code, notes, and snippets.

@mraichelson
Created July 22, 2010 00:10
Show Gist options
  • Save mraichelson/485362 to your computer and use it in GitHub Desktop.
Save mraichelson/485362 to your computer and use it in GitHub Desktop.
//
// Answers.m
// Answers
//
// Created by Michael Raichelson on 7/21/10.
// Copyright 2010 Pixis Creative. All rights reserved.
//
#import "Answers.h"
@implementation Answers
@synthesize answers;
-(NSMutableArray *) answers { // overrides the synthesized getter
if (!answers) {
self.answers = [NSMutableArray arrayWithObjects:
@"Oh yeah, big time!",
@"Not f'n likely!",
@"How would I know?",
@"Weasels?",
@"Let's have a meeting!",
nil
];
}
return answers;
}
-(NSUInteger)count {
return [self.answers count];
}
-(NSString *)answerAtIndex:(NSUInteger)theIndex {
return [self.answers objectAtIndex:theIndex];
}
-(void)removeAnswerAtIndex:(NSUInteger)theIndex {
[self.answers removeObjectAtIndex:theIndex];
}
-(void)addAnswer:(NSString *)theAnswer {
[self.answers insertObject:theAnswer atIndex:0];
}
-(void)dealloc {
[answers release];
[super dealloc];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment