Code:
-(IBAction)StartTheTimer:(id)sender{
[NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(updateCounter:) userInfo:nil repeats:YES];
}
- (void)updateCounter:(NSTimer *)theTimer {
static int count = 5;
count--;
NSString *s = [[NSString alloc]
initWithFormat:@"%d", count];
timeLeft.text = s;
[s release];
if(count==0)
{
timeLeft.text=@"done";
//[COLOR="Red"][NSTimer invalidate];[/COLOR]
}
}
If I uncomment [NSTimer invalidate] Then I get a warning.
: warning: 'NSTimer' may not respond to '+invalidate'