开发者

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

开发者 https://www.devze.com 2022-12-25 08:01 出处:网络
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'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

精彩评论

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