iOS 倒计时器

2018-05-23  本文已影响211人  makemake

简单的封装GCD的倒计时,不需要管理runloop,实现了APP在后台倒计时(APP进入后台再返回前台时对比当前的系统时间)demo点这里

使用:

 __block MKCoutDownTimer *t =  [MKCoutDownTimer timerWithCountdownTime:60.f rate:1.f executeBlock:^(int second){
        NSLog(@"倒计时%d",second);
        if (second == 50) {
            [t invalidate];
        }
    } endBlock:^{
        NSLog(@"结束");
    }];
demo.jpg
上一篇 下一篇

猜你喜欢

热点阅读