Latest 1.0.2
Homepage https://github.com/momo13014/SDCountdown
License MIT
Platforms ios 7.0, requires ARC
Authors

SDCountDownButton
CocoaPods compatible

SDCountdown

Countdown Button, with GCD, what you can do with code or XIB.
用GCD实现倒计时Button, 可以在多线程中使用,不用担心循环引用。
可以用纯代码或者Xib创建。

How to install

  • Cocoapods 安装
    ‘pod SDCountdownButton’
  • 手动安装
    将SDCountdown.h/m拖到工程中,手动引用
  • Carthage
    github "momo13014/SDCountDownButton"

How to Use SDCountdownButton

(Demo)

  • 你可以设置Button的初始化Title,可以和结束后的title不一样。默认为两者都为“获取验证码”
  • 如果你不需要在数字变化时的闪动效果,可将Button的type设置为Custom
    //设置变化过程中Button的title,如
    [SDCountDownButton setChangingFormatter:^NSString *(NSTimeInterval second) {
    return [NSString stringWithFormat:@"%.0lf S", second];
    }];
    //设置倒计时结束后的title
    [self.one setFinishedString:@"涨涨涨"];

    或者在Xib中直接设置finishString
    (png)

    //倒计时结束后的回调
    [SDCountDownButton completed:^{
    NSLog(@"The count down is over.");
    }];

Latest podspec

{
    "name": "SDCountDownButton",
    "version": "1.0.2",
    "summary": "A subclass of UIButton can countdown. customized chaningState's string or completion content",
    "description": "A subclass of UIButton can countdown. customized chaningState's string or completion content. you can create it with code or xib, it's ok. because of it's subclasss of UIButton, you can do it more",
    "homepage": "https://github.com/momo13014/SDCountdown",
    "authors": {
        "momo13014": "[email protected]"
    },
    "requires_arc": true,
    "platforms": {
        "ios": "7.0"
    },
    "license": "MIT",
    "source": {
        "git": "https://github.com/momo13014/SDCountdown.git",
        "tag": "1.0.2"
    },
    "source_files": "SDCountDonwButton/SDCountDownButton/*.{h,m}"
}

Pin It on Pinterest

Share This