开发者

Cocoa - Timer object that can be started, suspended, resumed?

I'm looking for a repeating timer object that allows me to create it once and then suspend and resume it as needed for the lifetime of my applicati开发者_开发知识库on.

I've seen documentation for NSTimer and although I think I can make it do what I want by building an abstraction on top of it that creates/invalidates timer objects multiple times, I was curios if there is a better way using some other system timer implementation. I'm not too familiar with Mac development and couldn't find any other leads besides NSTimer.


Although NSTimer has no "suspend" method, [timer setFireDate:[NSDate distantFuture]] has that effect. To resume, use [timer setFireDate:[NSDate date]], or similar.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜