在循环中使用NSTimer

Ste*_*ler 0 iphone cocoa-touch for-loop nstimer

我需要多次显示一个从30到0倒计时的计时器.(30到0,从30开始,等等)但是当我把它放在for循环中,而不是等到定时器无效开始下一个定时器时,循环遍历并创建几个定时器.

如何形成一个等待计时器失效的循环?

__CODE__ 构造函数.

Bru*_*ues 5

您可以使用scheduledTimerWithTimeInterval

[NSTimer scheduledTimerWithTimeInterval: 0.5
             target: self
             selector: @selector(handleTimer:)
             userInfo: nil
             repeats: NO];
Run Code Online (Sandbox Code Playgroud)

在handleTimer中创建下一个计时器