Not enough rep to upvote Tom, but he's absolutely right. Within the context of this question, NSTimer is the WRONG solution. The Cocos2d framework provides a scheduler that integrates with other game features like Pause/Resume (and most likely uses NSTimer under the hood).
Example from the above link:
-(id) init
{
if( ! [super init] )
return nil;
// schedule timer
[self schedule: @selector(tick:)];
[self schedule: @selector(tick2:) interval:0.5];
return self;
}
-(void) tick: (CCTime) dt
{
// bla bla bla
}
-(void) tick2: (CCTime) dt
{
// bla bla bla
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…