GCDTimer,解决进入后台,计时器停止问题 使用方法:
导入,
方法一:将Demo中的 HaiGCDTimerFramework.framework拖入你的项目中;
方法二:pod 方法,终端输入 pod search HaiGCDTimerPod ,然后导入到你的项目中,pod install;(
然后在要实现的地方导入头文件,并实现下面方法:
{
HaiTimer *haiTimer = [HaiTimer new];
[haiTimer timerWithTimeout:60 handlerBlock:^(int presentTime) {
NSLog(@"%d",presentTime);
_timeLable.text = [NSString stringWithFormat:@"%d",presentTime];
} finish:^{
_timeLable.text = @"0";
[haiTimer stopGCDTimer];
}];
}