All Products
Search
Document Center

Verification code input box

Last Updated: May 13, 2021

AUTextCodeInputBox is a verification code input control.

Sample images

API description

 
  1. /**
  2. The SMS verification code input box with a countdown timer.
  3. */
  4. @interface AUTextCodeInputBox : AUSecurityCodeBox
  5. /**
  6. The wait time before an SMS message is sent.
  7. */
  8. @property (nonatomic, assign) NSTimeInterval interval;
  9. /**
  10. * Create an SMS verification code input box.
  11. * @param frame The position and size in the parent class.
  12. * @param interval The wait time before an SMS message is sent.
  13. * @return The input box for the text message verification code.
  14. */
  15. - (AUTextCodeInputBox *)initWithFrame:(CGRect)frame interval:(NSTimeInterval)interval;
  16. /**
  17. * Create an SMS verification code input box.
  18. * @param originY The Y-coordinate of the component.
  19. * @param interval The wait time before an SMS message is sent.
  20. * @return The input box for the text message verification code.
  21. */
  22. - (AUTextCodeInputBox *)initWithOriginY:(CGFloat)originY interval:(NSTimeInterval)interval;
  23. /**
  24. * Set a block to be executed when countdown ends.
  25. * @param block The block to be executed.
  26. */
  27. - (void)setCountdownDidCompleteBlock:(void (^)(void))block;

Code sample

 
  1. AUTextCodeInputBox *smsInputBox = [[AUTextCodeInputBox alloc] initWithOriginY:startY interval:60];
  2. [smsInputBox.actionButton addTarget:self action:@selector(onSmsButtonClicked:) forControlEvents:UIControlEventTouchUpInside]; // The callback for processing the event that the button on the right is tapped.
  3. [self.view addSubview:smsInputBox];