UIButton+CountDown.h
#import <UIKit/UIKit.h>
typedef void(^RunBlock)(UIButton *button, NSInteger totalTime, NSInteger leftTime);
typedef void(^EndBlock)(UIButton *button);
@interface UIButton (CountDown)
/**
* 倒计时按钮
*
* @param duration 总时间
* @param runBlock 倒计时期间回调
* @param endBlock 倒计时结束回调
*/
- (void)startWithDuration:(NSInteger)duration
running:(RunBlock)runBlock
finished:(EndBlock)endBlock;
@end
UIButton+CountDown.m