Git Product home page Git Product logo

dyfcountdownbutton's Introduction

如果此项目能帮助到你,就请你给一颗星。谢谢!(If this project can help you, please give it a star. Thanks!)

License MIT 

DYFCountDownButton

一个倒计时按钮,操作简单好用。(A countdown button for iOS, the operation is simple and easy to use.)

Group (ID:614799921)

Preview

Usage

  • 实例化与布局

直接在 storyboard 或在 xib 绘制,设置约束,省去手工代码。

  • 配置
- (void)configureCountDownButton {
    [self.m_button configureWithDuration:20 countDownStart:^(DYFCountDownButton *_sender, NSInteger startValue) {

        NSString *title = [NSString stringWithFormat:@"%zis后重新发送", startValue];
        [_sender setTitle:title forState:UIControlStateNormal];

    } countDownUnderway:^(DYFCountDownButton *_sender, NSInteger restValue) {

        NSString *title = [NSString stringWithFormat:@"%zis后重新发送", restValue];
        [_sender setTitle:title forState:UIControlStateNormal];

    } countDownEnd:^(DYFCountDownButton *_sender) {

        NSString *title = [NSString stringWithFormat:@"获取验证码"];
        [_sender setTitle:title forState:UIControlStateNormal];
    }];
}
  • 开始倒计时
- (IBAction)getMsgVerifiedCode:(id)sender {
    [self.m_button startCountDown];
}
  • 结束倒计时

当任务失败或者需要提前终止倒计时,调用此方法。(When the task fails or the countdown needs to be terminated in advance, you call this method.)

- (IBAction)endCountDown:(id)sender {
    [self.m_button endCountDown];
}

Code Sample

dyfcountdownbutton's People

Contributors

itenfay avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.