{"id":19590229,"url":"https://github.com/shaojiankui/jkcountdownbutton","last_synced_at":"2025-04-05T13:05:42.787Z","repository":{"id":28324423,"uuid":"31837418","full_name":"shaojiankui/JKCountDownButton","owner":"shaojiankui","description":"JKCountDownButton,子类化UIButton实现IOS倒计时按钮,常常用于注册等发送验证码的时候进行倒计时操作","archived":false,"fork":false,"pushed_at":"2018-09-20T07:31:20.000Z","size":59,"stargazers_count":459,"open_issues_count":1,"forks_count":103,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-29T12:05:09.365Z","etag":null,"topics":["countdown","countdownbutton","objective-c"],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shaojiankui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-08T03:47:42.000Z","updated_at":"2025-03-05T09:44:37.000Z","dependencies_parsed_at":"2022-08-17T17:15:37.551Z","dependency_job_id":null,"html_url":"https://github.com/shaojiankui/JKCountDownButton","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaojiankui%2FJKCountDownButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaojiankui%2FJKCountDownButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaojiankui%2FJKCountDownButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaojiankui%2FJKCountDownButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaojiankui","download_url":"https://codeload.github.com/shaojiankui/JKCountDownButton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339155,"owners_count":20923014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["countdown","countdownbutton","objective-c"],"created_at":"2024-11-11T08:23:57.458Z","updated_at":"2025-04-05T13:05:42.760Z","avatar_url":"https://github.com/shaojiankui.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JKCountDownButton\nJKCountDownButton,子类化UIButton实现IOS倒计时按钮,常常用于注册等发送验证码的时候进行倒计时操作\n\nJKCountDownButton, subclassing UIButton implementation iOS countdown button, register with sending the verification code and countdown\n\n## Installation\n\n### Installation with CocoaPods\n\n\tplatform :ios\n \tpod 'JKCountDownButton'\n \t\n### Manually\n\nCopy JKCountDownButton.h JKCountDownButton.m in JKCountDownButton/ to your project.\n\n## Usage\n### Code\n    JKCountDownButton *_countDownCode;\n    _countDownCode = [JKCountDownButton buttonWithType:UIButtonTypeCustom];\n    _countDownCode.frame = CGRectMake(81, 200, 108, 32);\n    [_countDownCode setTitle:@\"开始\" forState:UIControlStateNormal];\n    _countDownCode.backgroundColor = [UIColor blueColor];\n    [self.view addSubview:_countDownCode];\n    \n     [_countDownCode countDownButtonHandler:^(JKCountDownButton*sender, NSInteger tag) {\n        sender.enabled = NO;\n\n        [sender startCountDownWithSecond:10];\n\n        [sender countDownChanging:^NSString *(JKCountDownButton *countDownButton,NSUInteger second) {\n            NSString *title = [NSString stringWithFormat:@\"剩余%zd秒\",second];\n            return title;\n        }];\n        [sender countDownFinished:^NSString *(JKCountDownButton *countDownButton, NSUInteger second) {\n            countDownButton.enabled = YES;\n            return @\"点击重新获取\";\n            \n        }];\n\n    }];\n\n    \n###xib\n    @property (weak, nonatomic) IBOutlet JKCountDownButton *countDownXib;\n\n    - (IBAction)countDownXibTouched:(JKCountDownButton*)sender {\n    sender.enabled = NO;\n    //button type要 设置成custom 否则会闪动\n    [sender startCountDownWithSecond:60];\n \n    [sender countDownChanging:^NSString *(JKCountDownButton *countDownButton,NSUInteger second) {\n        NSString *title = [NSString stringWithFormat:@\"剩余%zd秒\",second];\n        return title;\n    }];\n    [sender countDownFinished:^NSString *(JKCountDownButton *countDownButton, NSUInteger second) {\n        countDownButton.enabled = YES;\n        return @\"点击重新获取\";\n        \n    }];\n}\n## License\n\nThis code is distributed under the terms and conditions of the MIT license.\n\n## Demo\n![](https://raw.githubusercontent.com/shaojiankui/JKCountDownButton/master/demo.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaojiankui%2Fjkcountdownbutton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaojiankui%2Fjkcountdownbutton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaojiankui%2Fjkcountdownbutton/lists"}