This is a "trivial" question, so the next time, don't post it in Advanced Discussion.
Code:
- (void)viewDidLoad
{
[super viewDidLoad];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(targetMethod:) userInfo:nil repeats:YES];
}
int fired = 0;
-(void) targetMethod: (NSTimer *) theTimer {
if(fired<=10){
//do stuff
NSLog(@"fire:%d",fired);
fired++;
}else{
[theTimer invalidate];
theTimer = nil;
NSLog(@"INVALIDATED");
}
}