开发者

how to remove timer

开发者 https://www.devze.com 2023-02-01 04:49 出处:网络
i have this timer [NSTime开发者_开发问答r scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateTimerFunc) userInfo:nil repeats:YES];

i have this timer

[NSTime开发者_开发问答r scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateTimerFunc) userInfo:nil repeats:YES];

and on some function i want to completly remove this...how?


You should not use NSTimer in Cocos2d, instead you should do:

[self schedule:@selector(updateTimerFunc) interval:1.0];

And to remove it:

[self unschedule:@selector(updateTimerFunc)];

or:

[self unscheduleAllSelectors];

If you have an update-function you could use: [self scheduleUpdate];

0

精彩评论

暂无评论...
验证码 换一张
取 消