All Products
Search
Document Center

Numeric keypad component

Last Updated: May 25, 2021

AUNumKeyboards is a custom numeric keypad component.

Sample images

  • Common mode

  • Chat mode

API description

 
  1. typedef NS_ENUM(NSInteger, AUNumKeyboardMode) {
  2. AUNumKeyboardModeCommon, // The numeric keypad is in common mode.
  3. AUNumKeyboardModeChat, // The keypad is in chat mode.
  4. AUNumKeyboardModeInvalid // The keypad is in invalid mode and unavailable.
  5. };
  6. /**
  7. Define a numeric keypad.
  8. */
  9. @interface AUNumKeyboards : UIView
  10. /**
  11. * Create a numeric keypad component, which uses the common mode by default.
  12. *
  13. * @return Return the initialized numeric keypad component.
  14. */
  15. + (AUNumKeyboards *)sharedKeyboard;
  16. /**
  17. * Create a numeric keypad component.
  18. *
  19. * @param mode The numeric keypad mode.
  20. *
  21. * @return Return the initialized numeric keypad component.
  22. */
  23. + (AUNumKeyboards *)sharedKeyboardWithMode:(AUNumKeyboardMode)mode;
  24. /**
  25. * Manually set textInput. The Y-coordinate of the numeric keypad needs to be set externally.
  26. */
  27. @property (nonatomic, weak) id<UITextInput> textInput;
  28. /**
  29. * The ID card number.
  30. */
  31. @property (nonatomic, assign) BOOL idNumber;
  32. /**
  33. * Set the numeric keypad mode.
  34. */
  35. @property (nonatomic, assign, readonly) AUNumKeyboardMode mode;
  36. /**
  37. * Specify whether to hide the decimal point.
  38. */
  39. @property (nonatomic, assign) BOOL dotHidden;
  40. /**
  41. * Specify whether to hide the numeric keypad.
  42. */
  43. @property (nonatomic, assign) BOOL dismissHidden;
  44. /**
  45. * Specify whether the submit button is clickable.
  46. */
  47. @property (nonatomic, assign) BOOL submitEnable;
  48. /**
  49. * The text of the submit button.
  50. * Note: To ensure the visual requirement, the text supports a maximum of six characters.
  51. */
  52. @property (nonatomic, strong) NSString *submitText;

Code sample

 
  1. UITextField *numTextField = ...
  2. numTextField.inputView = [AUNumKeyboards sharedKeyboardWithMode:AUNumKeyboardModeCommon] ; // The chat mode parameter: AUNumKeyboardModeChat.
  3. [self.view addSubview:numTextField];