ios封裝獲取驗證碼

2021-07-23 19:48:27 字數 1227 閱讀 2308

在開發應用中,我們有很多時候都用到註冊或者找回密碼,我們都需要獲取驗證碼,在很多時候我們使用起來都會在使用處進行方法實現,那樣使得**的耦合性降低,最近在開發中我也遇到這樣的問題,所以對其進行 乙個簡單的封裝首先,我們建立乙個繼承於nsobject的類verification

在其的.h 中我們建立幾個方法

+(verification *)sharever;

-(void )verificationaction:(uitextfield *)phonetext verbtn:(uibutton *)verbtn;

-(nsstring *)string;

然後在其.m中進行方法實現,這裡我已倒計60秒為例

+(verification *)sharever);

return manager;

}

-(void)verificationaction:(uitextfield *)phonetext verbtn:(uibutton *)verbtn 

nsdictionary *dict = @;

// 呼叫查詢手機號的介面

if ([[responseobject objectforkey:@"data"] integervalue]) else failure:^(nserror *error, gjkerror *jjerror) ];

}} failure:^(nserror *error, gjkerror *jjerror) ];

}

- (void)stoptimer

}-(void)setcountdownstate:(uibutton *)verbtn mobiletext:(uitextfield *)phonetextfield repeats:yes];

}- (void)countdownaction:(uibutton*)verbtn mobiletext:(uitextfield *)phonetextfield else

}- (void)showcurrentremainsecond:(uibutton *)verbtn

- (void)resumeverifybuttonstatus:(uitextfield*)phonetextfield verbtn:(uibutton *)verbtn

-(nsstring *)string

IOS自動獲取簡訊驗證碼

img 1.自定義監聽類 簡訊 用於自動填充驗證碼 public class smscontentobserver extends contentobserver override public void onchange boolean selfchange 要讀取的屬性 address and ...

獲取驗證碼

doctype html en utf 8 viewport content width device width,initial scale 1.0 獲取驗證碼 title script head button id btn value 獲取驗證碼 body setinterval 方法可按照指定...

C 獲取驗證碼

using system using system.collections.generic using system.componentmodel using system.data using system.drawing using system.text using system.window...