I need a way to ensure that phone numbers have 10 digits with no other characters ie () - and make sure that email addresses are valid emails (formatted correctly).
Is t
Here's Simple Example for UITextField Validation while type in keyboard other characters not displaying
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
//UITextField *tf_phonenumber,*tf_userid;
if (textField.text<=10) {
char c=*[string UTF8String];
if (tf_phonenumber==textField) //PhoneNumber /Mobile Number
{
if ((c>='0' && c<='9')||(c==nil)) {
return YES;
}
else
return NO;
}
if (tf_userid==textField) //UserID validation
{
if ((c>='a' && c<='z')||(c>='A' && c<='Z')||(c==' ')||(c==nil)) {
return YES;
}
else
return NO;
}
return YES;
}
else{
return NO;
}
}