I try to validate the Textfield with special characters,
But, Pressing on delete button from keypad. Text filed data not removing.
I used this code to validate Textfield,
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
NSCharacterSet * invalidNumberSet = [NSCharacterSet characterSetWithCharactersInString:@"_!@#$%^&*()[]{}'\"<>:;|\\/?+=~`"];
if([[string stringByTrimmingCharactersInSet:invalidNumberSet]isEqualToString:@""])
{
return NO;
}
else
{
return YES;
}
}
please, suggest me how can i do that?
Create Common function like this to implement your feature,
and use it as
This will not accept special characters from your keyboard to your textfield, though you press that letters from your keyboard.
If you have any doubt then tell me..I will help you..
Hope this will help for you..