I did the same code for some input boxes several times in some projects, and finally one day I couldn't help it, MD had to write a small framework to solve the problem of moving bricks. After a day of fighting, so jwtextfied silently born.
Frame Address: Https://github.com/NIUXINGJIAN/OC_PLAYGROUND.git
Benefits of using this framework: Save code, simplify operations, and highlight viewcontroller internal logic.
How to use this framework:
A: Go to the GitHub address and download the framework.
B: Import the demo jwtextfiled folder into the project.
C: The use of the introduction of the header file #import "JwTextFiled.h" can be, the coupling degree is very low.
D: Check the jwtextfiled_example use steps.
Framework parsing:
A categorie, yes, is a uitextfiled class extension, we write the checksum of all input box types in the extension, with strong customization.
A black box hint of encapsulation, as one of the cue effects.
A multi-button cue box is introduced as one of the prompt effects that can be customized.
What can jwtextfiled do for you?
0, using very little code implementation of one or a set of input box input length to do input restrictions.
1, Support input box type: User name, password, verification code, transaction amount, ID card, bank card, mobile number, email, credit card validity, credit card security code input box check, you can expand your own changes as needed.
2, support error check rule: see the code internal regular comments.
3, prompt type: Do not prompt, silently check; check and prompt (support system prompt, black box hint, user custom prompt)
4, prompt content: Through the function of the value, be able to check the failure, and the input box is empty when prompted.
5, the input box current input content callback, through a single traversal, can get all input boxes in time input information.
Customization:
The user can set the maximum input length limit for the input box by modifying the macro definition inside the frame.
The user can modify the check method of the adjustment input box to check the settings of some input boxes.
Attention:
Amount input Box enter the rule:
1, the first input decimal point, automatic front 0.
2, only one decimal point can be entered, if two consecutive decimal points, the second input is forbidden.
3, the decimal place can only have two bits, the extra input is automatically forbidden.
4, enter the amount limit of the last one when the decimal point, you are prompted, and delete the decimal point.
ID input Box Input rules:
1. Up to 18 bits can be entered.
2, if the last thought is a lowercase x, then automatically converted to uppercase X.
3, the 18-bit length of the ID card number made the identification card algorithm verification.
The others here are no longer one by one outlined.
You in the use of the process, encountered any problems, please promptly in the jwtextfiled_example to contact me, I will help you to resolve in a timely manner.
Instructions on using the jwtextfiled framework