# GDPTimeDownButton **Repository Path**: luohanguo1222/GDPTimeDownButton ## Basic Information - **Project Name**: GDPTimeDownButton - **Description**: GDPTimeDownButton - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-07-28 - **Last Updated**: 2022-08-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: MIT, NSTimer ## README # GDPTimeDownButton 验证码倒计时按钮 ## 效果 ![GDPCountDownButton](https://github.com/sunmumu/GDPCountDownButton/blob/main/Demo/%E6%95%88%E6%9E%9C.GIF?raw=true) ## Use 法一 cocopods引用 pod 'GDPTimeDownButton', :git => 'https://gitee.com/luohanguo1222/GDPTimeDownButton.git' 法二 文件拖入项目中 1. 把GDPTimeDownButton文件夹拖入项目中 2. 在控制器中#import "GDPTimeDownButton.h". ## 创建方法 ``` GDPTimeDownButton *button = [GDPTimeDownButton buttonWithType:UIButtonTypeCustom]; button.btnNormalColor=[self convertHexToRGB:@"2da4f1"]; button.btnCountDownColor=[self convertHexToRGB:@"b9b9b9"]; [button setTitle:@"获取验证码" forState:UIControlStateNormal]; button.titleLabel.font=[UIFont systemFontOfSize:16]; button.normalColor=[self convertHexToRGB:@"ffffff"]; button.countDownColor=[self convertHexToRGB:@"ffffff"]; button.frame = CGRectMake(100, 100, 120, 60); [self.view addSubview:button]; [button addClickBlock:^(GDPTimeDownButton * _Nonnull sender) { [sender startWithSecond:60]; } finishedBlock:^NSString * _Nullable(GDPCountDownButton * _Nonnull sender, int second) { return @"获取验证码"; }]; ``` ## License GDPTimeDownButton is released under a MIT License. See LICENSE file for details.