移动开发平台 mPaaS 验证码输入框

By | 2021年4月23日

AUTextCodeInputBox 为验证码输入控件。

效果图


接口说明

  
  1. /**
  2. 短信验证码输入框,带倒计时按钮
  3. */
  4. @interface AUTextCodeInputBox : AUSecurityCodeBox
  5. /**
  6. 发送短信前的等待时间
  7. */
  8. @property (nonatomic, assign) NSTimeInterval interval;
  9. /**
  10. * 创建短信验证码输入框
  11. * @param frame 在父类的位置和大小
  12. * @param interval 发送短信前的等待时间
  13. * @return 短信验证码输入框
  14. */
  15. - (AUTextCodeInputBox *)initWithFrame:(CGRect)frame interval:(NSTimeInterval)interval;
  16. /**
  17. * 创建短信验证码输入框
  18. * @param originY 组件的 Y 坐标
  19. * @param interval 发送短信前的等待时间
  20. * @return 短信验证码输入框
  21. */
  22. - (AUTextCodeInputBox *)initWithOriginY:(CGFloat)originY interval:(NSTimeInterval)interval;
  23. /**
  24. * 设置倒计时结束时执行的 block
  25. * @param block 执行的 block
  26. */
  27. - (void)setCountdownDidCompleteBlock:(void (^)(void))block;

代码示例

  
  1. AUTextCodeInputBox *smsInputBox = [[AUTextCodeInputBox alloc] initWithOriginY:startY interval:60];
  2. [smsInputBox.actionButton addTarget:self action:@selector(onSmsButtonClicked:) forControlEvents:UIControlEventTouchUpInside]; // 处理右侧按钮的点击回调
  3. [self.view addSubview:smsInputBox];

请关注公众号获取更多资料

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注