Просто следите за количеством циклов и сохраняйте ссылку на объект таймера. Тогда просто лишите законной силы, когда вы сделали достаточно.
// ivars
int loopCount;
NSTimer *myTimer;
// Method that calls your timer.
- (void)doStuff {
loopCount++;
if (loopCount >= 10) {
[myTimer invalidate];
myTimer = nil;
} else {
//do my stuff here...
}
}
// Method that kicks it all off
- (IBAction)startDoingStuff {
myTimer = [NSTimer scheduledTimerWithTimeInterval:3.0
target:self
selector:@selector(doStuff)
userInfo:nil
repeats:YES];
}