gpt4 book ai didi

iphone - CCTimer 没有触发它应该触发的方法?也 selfSchedule 覆盖自己

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:50:00 25 4
gpt4 key购买 nike

2个问题我无法使 CCTimer 工作,而且我已经通过问题进行了大量研究。然而,我确实让 NSTimer 工作得很好,假设我使用了这个:

[NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(bombExplodes:) userInfo:0 repeats:1];

[CCTimer timerWithTarget:self selector@selector(bombExplodes:) interval:3]

我知道 CCTimer 应该会在 3 秒内启动 bombExplodes 方法。但是它就是不这样做!同时,NSTimer 正常工作!我不太确定我做错了什么..

此外,我之前尝试过使用 selfSchedule,尽管它工作正常,但我对此有一个小疑问..假设调用了一个 selfSched 调用,它应该在 5 秒内启动一个方法。如果在启动该方法之前再次调用同一个 selfSched 调用,我注意到它几乎取消了第一次调用(因此覆盖了它)。这应该发生吗?

谢谢!

最佳答案

这可能对你有帮助

[self performSelector:@selector(bombExplodes:)withObject:nil afterDelay:3.0];

关于iphone - CCTimer 没有触发它应该触发的方法?也 selfSchedule 覆盖自己,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13171020/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com