CRTimeButton 0.0.4

CRTimeButton 0.0.4

CRKit维护。



CRTimeButton

CocoaPods

  1. pod 'CRTimeButton'添加到您的Podfile中。
  2. 运行pod installpod update
  3. 导入

示例

    CRTimeButton *button = [CRTimeButton new];
    button.delegate = self;
    button.frame = ...;
    [button setDefaultTitle:@"获取验证码"];
    [button setAgainTitle:@"重新发送"];
    [button setDuration:30];
    [button setCounDownPrifex:@"还剩"];

    #pragma mark - CRTimeButtonDelegate
    - (void)timeButtonClicked:(CRTimeButton *)timeButton {
        // 模拟网络请求
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [timeButton resetButton]; // 模拟网络发送失败,重置按钮状态
        });
    }

快照

snapshot