Skip to content

vimalmurugan89/MVTextField

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

MVTextField

It has the following features,

MVTextFieldType

MVTextFieldMoneyFormatType - Which is used to accept money format entry(like 2.5,234.50).
MVTextFeildNumberType - Which is accept only number value.
MVTextFieldStringType - Which is accept only string value.
MVTextFieldStringWithNumberType - Which is accept string with number. It won't accept special character.
MVTextFieldDefautType - Which is accept all values like default text field.

MVTextfieldValidationType

MVMailValidationType - Validate Entered text is email or not
MVEmptyValidationType - Validate textfield is empty or empty spaces.
MVValidationTypeNone - No validation.

MVKeyBoardType

This is custom keyboard for your specific field
MVNumberKeyBoardType - It shows custom keyboard which is created by me.

Custom Keyboard


MVTextField text margin adjust

1. Use marginValue property to adjust the text from left side.

MVTextField Restrict number of character entry

1. Use allowedTextLength to restrict the number of character entry into the textfield.
2. Use allowedDecimalLength to restrict the character entry after dot entered.

MVTextField block methods which is equalent to textfield delegate methods

TextFieldDidBeginEditBlock - Which is called while textfield edit begun.
TextFieldDidEndEditBlock - Which is called while textfield end editing.
TextDidChangeBlock - Which is called while textfield charcater change.

Who need this?

1. Who's need money format entry in text field (like 124.98)?
2. Who's need to restrict the number of character entry?
3. Whom wants to integrate custom keyboard into the text field?
4. Who's need email validation on textfield?

Future Enhancement

1. Integrate showing visual validation on textfield leftview for email,number and etc...
2. Custom keyboard customization like changing background color and title color and etc..
3. Add new type of keyboard.
4. Add icon on left and right view with simple method.

Implementation

 MVTextField  *_defaultTextField=[[MVTextField alloc]init];
 //Set textfield type
 _defaultTextField.fieldType=MVTextFeildNumberType;

//Set maximum length of text
_defaultTextField.allowedTextLength=4;

//Set maximum length after entering dot
_defaultTextField.allowedDecimalLength=3;

//Set margin value for text as well as placeholder
_defaultTextField.marginValue=2;

//Set validation type
_defaultTextField.textFieldValidationType=MVMailValidationType;

//Set return string value if validation got failed
_defaultTextField.validationString=@"Mail id is incorrect";

//Set custom key board type if fieldtype is not a numberpad means it won't work
_defaultTextField.textFieldKeyBoardType=MVNumberKeyBoardType;

//Set Block method for textfield didbegin editing delegate
[_defaultTextField showWithBeginEditingValue:^(UITextField *textField) {
    NSLog(@"did begin editing");
}];

//Set Block method for textfield endediting delegate
[_defaultTextField showWithEndEditingValue:^(UITextField *textField) {
      NSLog(@"edit end %@",textField.text);
    
    //check validation when textfield end editing value called by calling below method
    // If nil means validation success
    // If return the validationstring means validation got failed.
      NSLog(@"valid==%@",[_defaultTextField validateTheTextField]);
}];

//Set Block method for textfield textdidchange delegate
[_defaultTextField showTextDidchange:^(UITextField *textField) {
    NSLog(@"text change %@",textField.text);
  
}];

About

Style and features of textfield

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published