I need help trying to figure out how to declare my countDown thingy. I need to know how and where to declare it. can anyone help me? I followed the tutorial by Nitrex88 and I just omitted the animation part of the code. and i keep getting the " 'countDown' undeclared first use in function. " error. I've included the timer part of the .m file and the entire .h file.
Code:
//Timer
-(IBAction)timeStart {
time = 60.0;
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:(countDown) userInfo:nil repeats:YES]; <<<<ERROR HERE----
}
-(void) countDown {
time = time - 1;
if (timer == 0){
[timer invalidate];
}
[self updateTimeLabel];
}
-(void) updateTimeLabel {
timeLabel.text = [NSString stringWithFormat:@"%i Sec", time];
}
Here's my .h
Code:
@interface iTap_Really_FastViewController : UIViewController {
IBOutlet UILabel *timeLabel;
NSTimer *timer;
NSUInteger time;
IBOutlet UILabel *tapsLabel;
IBOutlet UIImageView *tapButton;
}
@property (nonatomic, retain) NSTimer *timer;
@property (nonatomic, retain) UILabel *timeLabel;
@property (nonatomic, retain) UILabel *tapsLabel;
@property (nonatomic, retain) UIImageView *tapButton;
-(void)updateLabelsFromTouches:(NSSet *)touches;
-(IBAction)timeStart;
-(void)countDown;
-(void)updateTimeLabel;