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.
精彩评论