【iOS_GitHub】驗證碼 && 密碼 校驗框(相似於支付寶、網商銀行等密碼校驗框)

JhtVerificationCodeBox(校驗框)

先上圖,看一下是否符合你的場景吧!

Function Description

  1. 密文 || 明文輸入
  2. 變色 || 抖動清空
  3. 呼吸閃爍佔位符下劃線

how to use

1. 簡單的初始化:快速集成作這些就夠了

JhtVerificationCodeView *verificationCodeView = [[JhtVerificationCodeView alloc] initWithFrame:CGRectMake(40, 20 + 40 + 100 * i, CGRectGetWidth(self.view.frame) - 80, 60)];
verificationCodeView.endEditBlcok = ^(NSString *text) {
     NSLog(@"輸入的驗證碼爲:%@", text);
};
複製代碼

2. 選配項 :根據需求作相關property的配置

#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;
複製代碼

3. 經常使用方法說明

/** 改變全部已輸入驗證碼的顏色(一般在輸入驗證碼錯誤的狀況下用到)
 *  scenes:驗證碼輸入有誤變色
 *  hasShakeAndClear:是否須要抖動 && 清空
 */
- (void)changeAllAlreadyInputTextColorWithColor:(UIColor *)color hasShakeAndClear:(BOOL)hasShakeAndClear;

// 變色 && 震動 && 清空
[verificationCodeView changeAllAlreadyInputTextColorWithColor:col hasShakeAndClear:YES];
複製代碼
  • 具體使用詳見demo

Github 傳送門git

相關文章
相關標籤/搜索