AUNumKeyboards is a custom numeric keypad component.
Sample images
Common mode
Chat mode
API description
typedef NS_ENUM(NSInteger, AUNumKeyboardMode) {
AUNumKeyboardModeCommon, // The numeric keypad is in common mode.
AUNumKeyboardModeChat, // The keypad is in chat mode.
AUNumKeyboardModeInvalid // The keypad is in invalid mode and unavailable.
};
/**
Define a numeric keypad.
*/
@interface AUNumKeyboards : UIView
/**
* Create a numeric keypad component, which uses the common mode by default.
*
* @return Return the initialized numeric keypad component.
*/
+ (AUNumKeyboards *)sharedKeyboard;
/**
* Create a numeric keypad component.
*
* @param mode The numeric keypad mode.
*
* @return Return the initialized numeric keypad component.
*/
+ (AUNumKeyboards *)sharedKeyboardWithMode:(AUNumKeyboardMode)mode;
/**
* Manually set textInput. The Y-coordinate of the numeric keypad needs to be set externally.
*/
@property (nonatomic, weak) id<UITextInput> textInput;
/**
* The ID card number.
*/
@property (nonatomic, assign) BOOL idNumber;
/**
* Set the numeric keypad mode.
*/
@property (nonatomic, assign, readonly) AUNumKeyboardMode mode;
/**
* Specify whether to hide the decimal point.
*/
@property (nonatomic, assign) BOOL dotHidden;
/**
* Specify whether to hide the numeric keypad.
*/
@property (nonatomic, assign) BOOL dismissHidden;
/**
* Specify whether the submit button is clickable.
*/
@property (nonatomic, assign) BOOL submitEnable;
/**
* The text of the submit button.
* Note: To ensure the visual requirement, the text supports a maximum of six characters.
*/
@property (nonatomic, strong) NSString *submitText;
Code sample
UITextField *numTextField = ...
numTextField.inputView = [AUNumKeyboards sharedKeyboardWithMode:AUNumKeyboardModeCommon] ; // The chat mode parameter: AUNumKeyboardModeChat.
[self.view addSubview:numTextField];