jean bernard
jean bernard

Reputation: 257

call a method one time With a CADisplayLink

So I have a method with a CADisplayLink on it.In this method I have :

 if (leScore % 1000 == 0) { 
            //call a method one time        
 }

I would like to call a method one time if % 1000 == 0, my problem is that as there is a CADisplayLink on my method I can't call just one time another method when % 1000 == 0(it call the method at 60fps).How can I solve this please ? sorry for my english I'm french :/

Upvotes: 0

Views: 197

Answers (1)

mikabast
mikabast

Reputation: 395

Just make a boolean variable to check if the method is called already or not. Set it to NO, then modify the if block like this:

if (!isMyMethodCalled && leScore % 1000 == 0) {
 isMyMethodCalled = YES;
// and call the method
}

Upvotes: 1

Related Questions