
特点 :
1.随意更改手机上的时间倒计时会出错?
不会.详解如下.
2.自定义的tableViewCell能不能用?
适用于任何自定义的tableViewCell都能用.
3.创建过多倒计时时间不准卡顿影响性能?
全局只开启一个GCD倒计时0卡顿.
4.使用复杂?
只需三步只需5行代码轻松搞定列表倒计时!
5.分组数据能不能用?
同样只需三步只需5行代码轻松搞定列表倒计时!
6.框架依赖太多?
只需要一个AFN即可.
7.有没有demo?
demo下载https://github.com/zhYes/YSTimeCountDown
效果展示http://www.jianshu.com/p/3c49b44e45b4
代码介绍篇:http://www.jianshu.com/p/85909aabf058


代码部分 : 1.不分组的使用步骤

/// 1.初始化 传入当前视图和数据数组
countDown = [[YSCountDown alloc] initWith:self.tableView :self.dataList];
注意点: 数据数组元素为结束时间的时间戳

/// 2.销毁
[countDown destoryTimer];

/// 3.绑定tag
cell.tag = indexPath.row;
cell.endTimeLabel.tag = 1314;
cell.endTimeLabel.text = [countDown countDownWithPER_SEC:indexPath];
注意点: 将要显示倒计时的label绑定tag为1314
-
代码部分 : 2.表格分组的使用步骤
区别在第三步如下:

/// 3.绑定tag
cell.tag = indexPath.section * 1000 + indexPath.row;
cell.endTimeLabel.tag = 1314;
cell.endTimeLabel.text = [countDown countDownWithPER_SEC:indexPath];
注意点: cell的tag为
section*1000 + row;
==>原理
一个定时器管理600个倒计时
========= 任何其他问题,欢迎留言,愿与你一起学习😁=====
=====选择做iOS开发都是真的猛士!加油吧==========

感谢小哥们给的建议,非常好.
新增字段BOOL
"isPlusTime"
默认为0,需传入结束时间时间戳
的数组,即开始倒计时.直至时间结束显示活动结束
.
赋值为1或者 YES, 传入开始时间的时间戳
,时间开始++,小于当前时间显示活动未开始
.

//2018年03月20日09:48:01更新:
//2018年03月20日09:48:01更新:
//2018年03月20日09:48:01更新:
~
有朋友反映出现了倒计时一万多天的情况,经过几次调试,发现我这里有一个获取当前时间时间戳的接口 用来校准服务器时间和手机当前时间的差值
当这个接口不好用 获取不到的时候就是这个样子了 建议让后台自己做个接口 来替换YSCountDown.m
里面的@"http://api.k780.com:88/?app=life.time&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json"
这个接口就好了,即:
接口位置.jpg
QQ20180320-095232.gif
注意:1.时间戳单位这里是秒.2.自己接口取时间戳的key替换.
2018年03月20日@end
2018年03月20日@end
2018年03月20日@end
~
网友评论
[_countDown destoryTimer];
_countDown = nil;
///重新创建赋值
_countDown = [[MKCountDown alloc] init];
[_countDown countDownWithPER_SEC:self.rituan :rituanModel.tuan];
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_YSCountDown", referenced from:
objc-class-ref in QTHomeViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)