定时器
来源:互联网 发布:mac 好用的卸载软件 编辑:程序博客网 时间:2024/05/18 06:25
{
int sum;
sum=60;
}
@property (nonatomic , strong) NSTimer *timer;//用于重新发送验证码按钮上倒计时
#pragma mark -- 定时器懒加载
- (NSTimer *)timer{
if (!_timer) {
_timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(cutdownTime) userInfo:nil repeats:YES];
[_timer setFireDate:[NSDate distantFuture]];
}
return _timer;
}
//定时器回调方法
- (void)cutdownTime{
_sum -- ;
NSString *buttonTitle = @"";
if (_sum >= 0) {
buttonTitle = [NSString stringWithFormat:@"%ds再次发送",_sum];
}else{
buttonTitle = @"再次发送";
YZMButton.enabled = YES;
[YZMButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
[self.timer invalidate];//销毁定时器
self.timer = nil;
}
[YZMButton setTitle:buttonTitle forState:UIControlStateNormal];
}
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- 定时器
- Spring注入中byType和byName的总结
- 图像匹配算法之ORB
- HBase基础教程--1.2.X版本--基础知识篇(二)
- 1-jQuery源码之块级作用域
- 如何判断一个SOCKET连接是否已经断开
- 定时器
- 支持emoji表情
- 求n!的算法和C 实现
- vue(2) -- vue在watch中监听对象属性的变化
- Intellij Idea创建基于Maven的SpringMVC+MyBatis项目
- iscsi
- Linux下查询tomcat日志中的异常信息
- Javascript的this用法
- tensorflow:AToolDeveloperGuideToTFModelFIles