JhtVerificationCodeView *verificationCodeView = [[JhtVerificationCodeView alloc] initWithFrame:CGRectMake(40, 20 + 40 + 100 * i, CGRectGetWidth(self.view.frame) - 80, 60)];
verificationCodeView.endEditBlcok = ^(NSString *text) {
NSLog(@"輸入的驗證碼爲:%@", text);
};
複製代碼
#pragma mark optional
/** 樣式
* default:VerificationCodeViewType_Custom
*/
@property (nonatomic, assign) JhtVerificationCodeViewType codeViewType;
/** 是否須要邊框(每一個格子的框)
* default:NO
*/
@property (nonatomic, assign) BOOL hasBoder;
/** 邊框顏色(hasBoder = YES)
* default:[UIColor grayColor]
*/
@property (nonatomic, strong) UIColor *boderColor;
/** 驗證碼總數
* default:6
*/
@property (nonatomic, assign) NSInteger total;
/** 文字顏色
* default:[UIColor blackColor]
*/
@property (nonatomic, strong) UIColor *textColor;
/** 文字UIFont
* default:[UIFont boldSystemFontOfSize:17]
*/
@property (nonatomic, strong) UIFont *textFont;
/** 是否須要佔位符下劃線
* default:NO
*/
@property (nonatomic, assign) BOOL hasUnderLine;
/** 佔位符下劃線顏色(hasUnderLine = YES)
* default:[UIColor grayColor]
*/
@property (nonatomic, strong) UIColor *underLineColor;
/** 未輸入狀態下佔位符下劃線是否閃爍
* default:NO
*/
@property (nonatomic, assign) BOOL isFlashing_NoInput;
/** 是否須要輸入位數滿後清空
* default:NO
*/
@property (nonatomic, assign) BOOL isClearWhenInputFull;
複製代碼
/** 改變全部已輸入驗證碼的顏色(一般在輸入驗證碼錯誤的狀況下用到)
* scenes:驗證碼輸入有誤變色
* hasShakeAndClear:是否須要抖動 && 清空
*/
- (void)changeAllAlreadyInputTextColorWithColor:(UIColor *)color hasShakeAndClear:(BOOL)hasShakeAndClear;
// 變色 && 震動 && 清空
[verificationCodeView changeAllAlreadyInputTextColorWithColor:col hasShakeAndClear:YES];
複製代碼
Github 傳送門git