objective c - Incomplete Implementation Errror -
keep getting error on last line @implementation line saying implementation incomplete. not sure problem is. cause this? posted header too.
added rest of code .m file.
#import "mmviewcontroller.h" @interface mmviewcontroller () -(void)timerfired:(nstimer*)thetimer; @end @implementation mmviewcontroller @synthesize remainingtime, playerscore, scrambledword; - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } -(void)viewdidload { [super viewdidload]; //do additional setup after loading view, typically nib. //initialize game model gamemodel = [[mmscramblermodel alloc] init]; //display time, score , scrambled word remainingtime.text = [nsstring stringwithformat:@"%i", gamemodel.time]; playerscore.text = [nsstring stringwithformat:@"%i", gamemodel.score]; scrambledword.text = [gamemodel getscrambledword]; //start game timer gametimer = [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(timerfired:) userinfo:nil repeats:yes]; } -(void) endgamewithmessage:(nsstring *)message { //call method end game //invalidate timer [gametimer invalidate]; //show alert results uialertview* alert = [[uialertview alloc] initwithtitle:@"game over!" message:message delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil]; [alert show]; } -(void) timerfired:(nstimer *)thetimer { //the timer fires method rougly every second [gamemodel timertick]; if(gamemodel.time <= 0){ remainingtime.text = 0; [self endgamewithmessage:@"you out of time. lose!"]; } else remainingtime.text = [nsstring stringwithformat:@"%i", gamemodel.time]; } @end #import <uikit/uikit.h> #import "mmscramblermodel.h" @interface mmviewcontroller : uiviewcontroller { mmscramblermodel* gamemodel; nstimer* gametimer; } -(ibaction)guesstap:(id)sender; -(void) endgamewithmessage:(nsstring*) message; @property (weak, nonatomic) iboutlet uitextfield * guesstext; @property (weak, nonatomic) iboutlet uilabel * scrambledword; @property (weak, nonatomic) iboutlet uilabel * remainingtime; @property (weak, nonatomic) iboutlet uilabel * playerscore; @end
look @ methods listed in .h file. @ methods implemented. since there two, it's pretty easy notice didn't implement 1 of them.
implement guesstap:
method.
Comments
Post a Comment