- Timer = [Nstimer scheduledtimerwithtimeinterval:1.0 target:self selector: @selector (timerfiremethod:) userinfo:nil Repeats:yes];
- Countdown Method Verification code implementation Countdown 60 seconds, 60 seconds after the start of the button transformation
- -(void) Timerfiremethod: (Nstimer *) Thetimer {
- if (seconds = = 1) {
- [Thetimer invalidate];
- seconds = 60;
- [Validcodebtn_ settitle:@"Get Verification Code" Forstate:uicontrolstatenormal];
- [Validcodebtn_ Settitlecolor:[uicolor Blackcolor] forstate:uicontrolstatenormal];
- [Validcodebtn_ Setenabled:yes];
- }else{
- seconds--;
- NSString *title = [NSString stringwithformat:msg_dynamic_code_wait,seconds];
- [Validcodebtn_ Settitlecolor:[uicolor Graycolor] forstate:uicontrolstatenormal];
- [Validcodebtn_ Setenabled:no];
- [Validcodebtn_ Settitle:title Forstate:uicontrolstatenormal];
- }
- }
- If the login succeeds, stop the reciprocal of the Verification Code,
- -(void) Releasetimer {
- if (timer) {
- if ([Timer respondstoselector: @selector (isValid)]) {
- if ([timer isValid]) {
- [Timer invalidate];
- seconds = 60;
- }
- }
- }
- }
iOS Simple Countdown Verification code number of seconds process implementation