3)、移除定时器
- (void)dealloc {
[self.countDownTimer invalidate];
}
使用示例
1)、添加vertificationCodeIDCountDownButton属性
@interface ViewController ()
/** 验证码倒计时的button */
@property (nonatomic, strong) IDCountDownButton *vertificationCodeIDCountDownButton;
@end
2)、创建vertificationCodeIDCountDownButton并进行相关设置
- (void)viewDidLoad {
[super viewDidLoad];
// 创建vertificationCodeIDCountDownButton
self.vertificationCodeIDCountDownButton = [[IDCountDownButton alloc] initWithFrame:CGRectMake(160, 204, 120, 44)];
// 添加点击事件
[self.vertificationCodeIDCountDownButton addTarget:self action:@selector(vertificationCodeIDCountDownButtonClick:) forControlEvents:UIControlEventTouchUpInside];
// 设置标题相关属性
[self.vertificationCodeIDCountDownButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[self.vertificationCodeIDCountDownButton setTitle:@"获取验证码" forState:UIControlStateNormal];
// 设置背景图片
[self.vertificationCodeIDCountDownButton setBackgroundImage:[UIImage imageNamed:@"redButton"] forState:UIControlStateNormal];
// 设置倒计时时长
self.vertificationCodeIDCountDownButton.durationOfCountDown = 10;
// 将vertificationCodeIDCountDownButton添加的控制器的view中
[self.view addSubview:self.vertificationCodeIDCountDownButton];
}
3)、实现点击事件触发的操作
- (void)vertificationCodeIDCountDownButtonClick:(UIButton *)button {
// TODO:调用服务器接口,获取验证码
}
四、关于AppIcon
添加AppIcon时需要遵循以下规则
1)、命名,以Icon开头(首字母大写),跟上@2x/@3x,如图:

2)、尺寸,必须按要求设置尺寸,如图

3)、图中所示的60pt对应的图片尺寸是










