Giter VIP home page Giter VIP logo

cfsecuritycodebutton's Introduction

简介

CFSecurityCodeButton是一个简约的验证码按钮。

CFSecurityCodeButton演示

功能

  1. 自定义Normal状态下文字和Disabled状态下文字
  2. 自动根据Normal和Disabled状态下文字设置宽高
  3. 自定义定时时间
  4. 自动根据按钮的主题色调整文字颜色
  5. 提供了代理方法监控按钮开始计时和计时结束
  6. 提供了一些好看的颜色供使用者选择

安装

将CFSecurityCodeButton.h、CFSecurityCodeButton.m拖入你的项目中

使用

  1. 创建 通过主题色创建一个CFSecurityCodeButton

    CFSecurityCodeButton *btSecurityCode_Blue = [[CFSecurityCodeButton alloc] initWithColor:CFColorDodgerBlue];

    提供了一些颜色供使用者选择

    CFColorCoral
    CFColorDodgerBlue
    CFColorDeepSkyBlue
    CFColorTurquoise
    CFColorWarmYellow
    CFColorMediumPurple
    CFColorSeaGreen
  2. 设置文字 如果没有设置,默认Normal状态会显示"发送验证码",Disabled状态会显示"再次发送(倒计时)" 如果需要自定义可以设置normalTitledisabledTitle属性

    btSecurityCode.normalTitle = @"自定义normal状态文字内容";
    btSecurityCode.disabledTitle = @"自定义disabled状态文字内容";

    CFSecurityCodeButton演示

  3. 设置倒计时 如果没有设置,默认倒计时为60秒 如果需要自定义可以设置time属性

    btSecurityCode.time = 60;
  4. 自动调节文字颜色 CFSecurityCodeButton会根据自身的颜色调节文字颜色,当颜色过深时文字将会变成白色,当颜色过浅时文字颜色将会变成黑色 CFSecurityCodeButton演示

  5. 代理 提供了两个代理方法监控按钮

    /**
     *  按钮被点击
     *
     *  @param securityCodeButton CFSecurityCodeButton对象
     */
    - (void)securityCodeButtonDidClicked:(CFSecurityCodeButton *)securityCodeButton;
    /**
     *  按钮倒计时结束
     *
     *  @param securityCodeButton CFSecurityCodeButton对象
     */
    - (void)securityCodeButtonTimingEnded:(CFSecurityCodeButton *)securityCodeButton;

    只需要实现CFSecurityCodeButtonDelegate,重写代理方法

反馈

如果有什么修改建议,可以发送邮件到[email protected],也欢迎到我的博客

cfsecuritycodebutton's People

Contributors

summertian4 avatar

Watchers

James Cloos 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.