IOS实现输入验证码、密码按位分割(二)

2020-01-14 18:45:20刘景俊

6、使用示例

在控制器中创建,并设置vertificationCodeInputView相关属性


- (void)viewDidLoad {
  [super viewDidLoad];
  self.view.backgroundColor = [UIColor lightGrayColor];
  self.vertificationCodeInputView = [[IDVertificationCodeInputView alloc] initWithFrame:CGRectMake(50, 250, 200, 45)];
  self.vertificationCodeInputView.backgroudImageName = @"1";
  // 验证码(显示数字)
  self.vertificationCodeInputView.secureTextEntry = NO;
  //self.vertificationCodeInputView.secureTextEntry = YES;
  [self.view addSubview:self.vertificationCodeInputView];
}

点击屏幕,打印验证码的内容


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
  NSLog(@"%@", self.vertificationCodeInputView.vertificationCode);
}

以上就是本文的全部内容,希望对大家的学习有所帮助。



注:相关教程知识阅读请移步到IOS开发频道。