NSString *emailString = textField.text;
NSString *emailReg = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",emailReg];
if (([emailTest evaluateWithObject:emailString] != YES) || [emailString isEqualToString:@""])
{
UIAlertView *loginalert = [[UIAlertView alloc] initWithTitle:@" Enter Email in" message:@"abc@example.com format" delegate:self
cancelButtonTitle:@"OK" otherButtonTitles:nil];
[loginalert show];
}
NSString *emailReg = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",emailReg];
if (([emailTest evaluateWithObject:emailString] != YES) || [emailString isEqualToString:@""])
{
UIAlertView *loginalert = [[UIAlertView alloc] initWithTitle:@" Enter Email in" message:@"abc@example.com format" delegate:self
cancelButtonTitle:@"OK" otherButtonTitles:nil];
[loginalert show];
}
No comments:
Post a Comment
Comment