JhtVerificationCodeBox 1.0.4

JhtVerificationCodeBox 1.0.4

Jinht 维护。



JhtVerificationCodeBox

先上图,看一下是否符合你的场景吧!

函数描述

  1. 密文输入或明文输入
  2. 变色或抖动清空
  3. 在占位符下划线处呼吸闪烁

如何使用

1. Podfile

platform:ios, '8.0'

target 'VerificationCodeBox' do

pod 'JhtVerificationCodeBox'
        
end

2. 简单的初始化:快速集成,做这些就够了

JhtVerificationCodeView *verificationCodeView = [[JhtVerificationCodeView alloc] initWithFrame:CGRectMake(40, 20 + 40 + 100 * i, CGRectGetWidth(self.view.frame) - 80, 60)];
verificationCodeView.endEditBlcok = ^(NSString *text) {
     NSLog(@"输入的验证码为:%@", text);
};

3. 选配项:根据需求进行相关属性配置

#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;

4. 常用方法说明

/** 改变所有已输入验证码的颜色(通常在输入验证码错误的情况下用到)
 *  scenes:验证码输入有误变色
 *  hasShakeAndClear:是否需要抖动 && 清空
 */
- (void)changeAllAlreadyInputTextColorWithColor:(UIColor *)color hasShakeAndClear:(BOOL)hasShakeAndClear;

// 变色 && 震动 && 清空
[verificationCodeView changeAllAlreadyInputTextColorWithColor:col hasShakeAndClear:YES];
  • 具体使用请参考demo(使用demo前请先 pod install

提醒

  • ARC
  • iOS >= 8.0
  • iPhone \ iPad

希望

  • 如果在使用过程中遇到bug,希望您能 Issues 我,谢谢或者尝试下载此框架的最新代码以查看bug是否已修复。
  • 如果您在使用过程中发现功能不足,希望您能 Issues 我,我很希望能为这个框架添加更多有用的功能,谢谢!